PageRenderTime 32ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/Source/Bifrost.Specs/Resources/for_ResourceInterceptor/when_intercepting.cs

#
C# | 25 lines | 21 code | 4 blank | 0 comment | 0 complexity | 36337adee73481647aabc2fac2eee70d MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. using Machine.Specifications;
  2. namespace Bifrost.Specs.Resources.for_ResourceInterceptor
  3. {
  4. public class when_intercepting : given.a_resource_interceptor
  5. {
  6. const string expected = "Something";
  7. static FakeInvocation invocation;
  8. static ClassWithString resources;
  9. static string resource_string;
  10. Establish context = () =>
  11. {
  12. resources = new ClassWithString();
  13. invocation = new FakeInvocation();
  14. invocation.Method = ClassWithString.SomeStringProperty.GetGetMethod();
  15. invocation.ReturnValueToSetOnProceed = expected;
  16. resource_resolver_mock.Setup(r=>r.Resolve(Moq.It.IsAny<string>())).Callback((string s) => resource_string = s);
  17. };
  18. Because of = () => interceptor.Intercept(invocation);
  19. It should_combine_type_and_propertyname_as_resource_name = () => resource_string.ShouldEqual(typeof(ClassWithString).Name + "." + ClassWithString.SomeStringProperty.Name);
  20. }
  21. }