PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms 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
 1using Machine.Specifications;
 2
 3namespace Bifrost.Specs.Resources.for_ResourceInterceptor
 4{
 5    public class when_intercepting : given.a_resource_interceptor
 6    {
 7        const string expected = "Something";
 8        static FakeInvocation invocation;
 9        static ClassWithString resources;
10        static string resource_string;
11
12        Establish context = () =>
13        {
14            resources = new ClassWithString();
15            invocation = new FakeInvocation();
16            invocation.Method = ClassWithString.SomeStringProperty.GetGetMethod();
17            invocation.ReturnValueToSetOnProceed = expected;
18            resource_resolver_mock.Setup(r=>r.Resolve(Moq.It.IsAny<string>())).Callback((string s) => resource_string = s);
19        };
20
21        Because of = () => interceptor.Intercept(invocation);
22
23        It should_combine_type_and_propertyname_as_resource_name = () => resource_string.ShouldEqual(typeof(ClassWithString).Name + "." + ClassWithString.SomeStringProperty.Name);
24    }
25}