/src/UnitTests/Proxy/MockInterceptor.cs

http://github.com/philiplaureano/LinFu · C# · 24 lines · 19 code · 5 blank · 0 comment · 0 complexity · 1bfe365366be3f180ef4a71c7549c58a MD5 · raw file

  1. using System;
  2. using LinFu.AOP.Interfaces;
  3. namespace LinFu.UnitTests.Proxy
  4. {
  5. public class MockInterceptor : IInterceptor
  6. {
  7. private readonly Func<IInvocationInfo, object> _implementation;
  8. public MockInterceptor(Func<IInvocationInfo, object> implementation)
  9. {
  10. _implementation = implementation;
  11. }
  12. public bool Called { get; set; }
  13. public object Intercept(IInvocationInfo info)
  14. {
  15. Called = true;
  16. return _implementation(info);
  17. }
  18. }
  19. }