protected BaseBinding() { var proxyPropertySetter = new ProxyPropertySetter( new ProxyFactory(new ProxyInterceptor(new SpecFlowScenarioContext(), new KeyGenerator())), new ScenarioPropertyFetcher()); proxyPropertySetter.SetupScenarioContextProxies(this); }
public void SetProperties_SetsAllPropertiesToTypeReturnedByProxyFactory() { // Arrange var testProperties = typeof (TestClass).GetProperties().Where(p => p.Name.StartsWith("TestProperty")).ToArray(); var fakeScenarioPropertyFetcher = A.Fake<IScenarioPropertyFetcher>(); A.CallTo(() => fakeScenarioPropertyFetcher.Fetch(A<Type>.Ignored)) .Returns(testProperties); var fakeProxyFactory = A.Fake<IProxyFactory>(); A.CallTo(() => fakeProxyFactory.Create(testProperties[0])) .Returns(11); A.CallTo(() => fakeProxyFactory.Create(testProperties[1])) .Returns(52); var proxyPropertySetter = new ProxyPropertySetter(fakeProxyFactory, fakeScenarioPropertyFetcher); var testClass = new TestClass(); // Act proxyPropertySetter.SetupScenarioContextProxies(testClass); // Assert testClass.TestProperty1.Should().Be(11); testClass.TestProperty2.Should().Be(52); }