//[Test] public void CustomProperties() { NamespaceParserRegistry.RegisterParser(typeof(WcfNamespaceParser)); IApplicationContext ctx = new XmlApplicationContext( ReadOnlyXmlTestResource.GetFilePath("ChannelFactoryObjectDefinitionParserTests.CustomProperties.xml", this.GetType())); Assert.IsTrue(ctx.ContainsObjectDefinition("channel")); RootObjectDefinition rod = ((IObjectDefinitionRegistry)ctx).GetObjectDefinition("channel") as RootObjectDefinition; Assert.IsNotNull(rod); Assert.IsTrue(rod.HasObjectType); Assert.AreEqual(typeof(ChannelFactoryObject <IContract>), rod.ObjectType); Assert.AreEqual(1, rod.ConstructorArgumentValues.NamedArgumentValues.Count); Assert.AreEqual("ecn", rod.ConstructorArgumentValues.GetNamedArgumentValue("endpointConfigurationName").Value); Assert.IsTrue(rod.PropertyValues.Contains("Credentials.Windows.ClientCredential")); Assert.AreEqual("Spring\\Bruno:gnirpS", rod.PropertyValues.GetPropertyValue("Credentials.Windows.ClientCredential").Value); ChannelFactoryObject <IContract> cfo = ctx.GetObject("&channel") as ChannelFactoryObject <IContract>; Assert.IsNotNull(cfo); Assert.AreEqual(typeof(IContract), cfo.ObjectType); Assert.AreEqual("Spring", cfo.Credentials.Windows.ClientCredential.Domain); Assert.AreEqual("Bruno", cfo.Credentials.Windows.ClientCredential.UserName); Assert.AreEqual("gnirpS", cfo.Credentials.Windows.ClientCredential.Password); IContract contract = ctx.GetObject("channel") as IContract; Assert.IsNotNull(contract); }
//[Test] public void BasicConfig() { NamespaceParserRegistry.RegisterParser(typeof(WcfNamespaceParser)); IApplicationContext ctx = new XmlApplicationContext( ReadOnlyXmlTestResource.GetFilePath("ChannelFactoryObjectDefinitionParserTests.BasicConfig.xml", this.GetType())); Assert.IsTrue(ctx.ContainsObjectDefinition("channel")); RootObjectDefinition rod = ((IObjectDefinitionRegistry)ctx).GetObjectDefinition("channel") as RootObjectDefinition; Assert.IsNotNull(rod); Assert.IsTrue(rod.HasObjectType); Assert.AreEqual(typeof(ChannelFactoryObject <IContract>), rod.ObjectType); Assert.AreEqual(1, rod.ConstructorArgumentValues.NamedArgumentValues.Count); Assert.AreEqual("ecn", rod.ConstructorArgumentValues.GetNamedArgumentValue("endpointConfigurationName").Value); ChannelFactoryObject <IContract> cfo = ctx.GetObject("&channel") as ChannelFactoryObject <IContract>; Assert.IsNotNull(cfo); Assert.AreEqual(typeof(IContract), cfo.ObjectType); IContract contract = ctx.GetObject("channel") as IContract; Assert.IsNotNull(contract); }