Guest User

Untitled

a guest
Jul 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. //Агрегаты
  2. dictionary.Add(root.Name.ToString(), "root");
  3. return root.Elements().Aggregate(dictionary,
  4. (d, x) =>
  5. {
  6. d.Add(x.Name.ToString(), x.Value);
  7. return d;
  8. });
  9.  
  10. //Чистое ооп + лямбда + шаблонный класс
  11. //Типа вызываем функцию которой еще нет :) Она будет определена в дочерних классах
  12. //TResponse, TRequest - о котором мы ничего не можем сейчас сказать
  13. protected abstract bool GetTest(PaymentTest test, TRequest request);
  14.  
  15. public TResponse Call(TRequest request)
  16. {
  17. PaymentTest test = PaymentTestsCacheHelper.Get(cache).Cast<PaymentTest>().SingleOrDefault(t => GetTest(t, request));
  18.  
  19. if (test == null)
  20. throw new EmulatorException(StatusCodes.mtERROR, "Тест не найден");
  21.  
  22. // обаботать запрос
  23. return Process(test);
  24. }
Add Comment
Please, Sign In to add comment