public void TryCreate_DerivedConfiguration_Created() { const string Property1Value = "Another test value"; const int Property2Value = 20; const string NewProperty1Value = "Derived property value"; var factory = new DynamicDataAdapterConfigurationFactory(); var proxy = factory.TryCreate( typeof(IDerivedConfiguration), new Dictionary <string, string> { { "Property1", Property1Value }, { "Property2", Property2Value.ToString() }, { "NewProperty1", NewProperty1Value }, }); Assert.IsNotNull(proxy, TestResources.NullProxyGenerated); Assert.IsTrue(proxy is IDerivedConfiguration, TestResources.InvalidProxyType); var typedProxy = (IDerivedConfiguration)proxy; Assert.AreEqual(Property1Value, typedProxy.Property1, TestResources.InvalidProxyPropertyValueFormat, "Property1"); Assert.AreEqual(Property2Value, typedProxy.Property2, TestResources.InvalidProxyPropertyValueFormat, "Property2"); Assert.AreEqual(NewProperty1Value, typedProxy.NewProperty1, TestResources.InvalidProxyPropertyValueFormat, "NewProperty1"); }
public void TryCreate_SimpleConfiguration_Created() { const string Property1Value = "Test value"; const int Property2Value = 10; var factory = new DynamicConfigurationFactory(); var proxy = factory.TryCreate( typeof(ISimpleConfiguration), new Dictionary <string, string> { { "Property1", Property1Value }, { "Property2", Property2Value.ToString() } }); Assert.IsNotNull(proxy, TestResources.NullProxyGenerated); Assert.IsTrue(proxy is ISimpleConfiguration, TestResources.InvalidProxyType); var typedProxy = (ISimpleConfiguration)proxy; Assert.AreEqual(Property1Value, typedProxy.Property1, TestResources.InvalidProxyPropertyValueFormat, "Property1"); Assert.AreEqual(Property2Value, typedProxy.Property2, TestResources.InvalidProxyPropertyValueFormat, "Property2"); }