public void SetItemTest() { PrivateObject param0 = CreateIniElement(); MappingCollection_Accessor target = new MappingCollection_Accessor(param0); // TODO: Initialize to an appropriate value int index = 0; Mapping item = target.CreateMapping(); item.Assembly = "or.dll"; target.SetItem(index, item); MappingCollection tar = (MappingCollection)target.Target; Assert.AreEqual("or.dll", tar[index].Assembly); }
public void ClearItemsTest() { PrivateObject param0 = CreateIniElement(); MappingCollection_Accessor target = new MappingCollection_Accessor(param0); MappingCollection tar = (MappingCollection)target.Target; tar.Clear(); IEnumerable <XElement> elements = from mappingNode in target.sessionFactoryEelement.Elements(xNamespace + "mapping") select mappingNode; XElement[] mappings = elements.ToArray <XElement>(); Assert.AreEqual(0, mappings.Length); Assert.AreEqual(0, tar.Count); }
public void RemoveItemTest() { PrivateObject param0 = CreateIniElement(); MappingCollection_Accessor target = new MappingCollection_Accessor(param0); // TODO: Initialize to an appropriate value int index = 0; target.RemoveItem(index); IEnumerable <XElement> elements = from mappingNode in target.sessionFactoryEelement.Elements(xNamespace + "mapping") select mappingNode; XElement[] mappings = elements.ToArray <XElement>(); Assert.AreEqual(0, mappings.Length); MappingCollection tar = (MappingCollection)target.Target; Assert.AreEqual(0, tar.Count); }
public void CheckAllLogic() { var c = @"<?xml version=""1.0"" encoding=""utf-8""?> <hibernate-configuration xmlns=""urn:nhibernate-configuration-2.2""> <session-factory name=""NHibernate.Test""> <!-- properties --> <property name=""connection.provider"">NHibernate.Connection.DriverConnectionProvider</property> <property name=""connection.driver_class"">NHibernate.Driver.SqlClientDriver</property> <property name=""connection.connection_string"">server=.\SQLEXPRESS;database=nhibernateDemo;uid=sa;pwd=sa</property> <property name=""show_sql"">false</property> <property name=""dialect"">NHibernate.Dialect.MsSql2005Dialect</property> <property name=""use_outer_join"">true</property> <property name=""proxyfactory.factory_class"">NHibernate.ByteCode.LinFu.ProxyFactoryFactory,NHibernate.ByteCode.LinFu</property> <!-- these are different than the values in app.config so I can verify these are being picked up --> <property name=""command_timeout"">500</property> <property name=""query.substitutions"">true 1, false 0, yes 1, no 0</property> <!-- mapping files --> <mapping assembly=""Ornament.MemberShip.Core"" /> <mapping assembly=""Ornament.MemberShip.2"" /> <mapping assembly=""Ornament.3MemberShip.2"" /> </session-factory> </hibernate-configuration>"; XDocument doc = XDocument.Parse(c); var element = doc.Root.Element(this.xNamespace + "session-factory"); MappingCollection_Accessor target = new MappingCollection_Accessor(element); var collection = (MappingCollection)target.Target; Assert.AreEqual(3, collection.Count); var mapping = collection.CreateMapping(); mapping.Assembly = "assembly.dll"; collection.Clear(); collection.Add(mapping); Assert.AreEqual(1, collection.Count); }
public void CheckAllLogic() { var c = @"<?xml version=""1.0"" encoding=""utf-8""?> <hibernate-configuration xmlns=""urn:nhibernate-configuration-2.2""> <session-factory name=""NHibernate.Test""> <!-- properties --> <property name=""connection.provider"">NHibernate.Connection.DriverConnectionProvider</property> <property name=""connection.driver_class"">NHibernate.Driver.SqlClientDriver</property> <property name=""connection.connection_string"">server=.\SQLEXPRESS;database=nhibernateDemo;uid=sa;pwd=sa</property> <property name=""show_sql"">false</property> <property name=""dialect"">NHibernate.Dialect.MsSql2005Dialect</property> <property name=""use_outer_join"">true</property> <property name=""proxyfactory.factory_class"">NHibernate.ByteCode.LinFu.ProxyFactoryFactory,NHibernate.ByteCode.LinFu</property> <!-- these are different than the values in app.config so I can verify these are being picked up --> <property name=""command_timeout"">500</property> <property name=""query.substitutions"">true 1, false 0, yes 1, no 0</property> <!-- mapping files --> <mapping assembly=""Ornament.MemberShip.Core"" /> <mapping assembly=""Ornament.MemberShip.2"" /> <mapping assembly=""Ornament.3MemberShip.2"" /> </session-factory> </hibernate-configuration>"; XDocument doc = XDocument.Parse(c); var element = doc.Root.Element(this.xNamespace + "session-factory"); MappingCollection_Accessor target = new MappingCollection_Accessor(element); var collection = (MappingCollection)target.Target; Assert.AreEqual(3, collection.Count); var mapping=collection.CreateMapping(); mapping.Assembly = "assembly.dll"; collection.Clear(); collection.Add(mapping); Assert.AreEqual(1, collection.Count); }
public void InsertItemTest_index0() { PrivateObject param0 = CreateIniElement(); MappingCollection_Accessor target = new MappingCollection_Accessor(param0); //Insert 第一位 int index = 0; Mapping item = target.CreateMapping(); item.Assembly = "ol.dll"; target.InsertItem(index, item); MappingCollection tar = (MappingCollection)target.Target; Assert.AreEqual <Int32>(2, tar.Count); Assert.AreEqual("ol.dll", tar[0].Assembly); //Insert 最后一位 item = target.CreateMapping(); item.Assembly = "ol1.dll"; index = tar.Count; target.InsertItem(index, item); Assert.AreEqual("ol1.dll", tar[2].Assembly); //insert 中间位置 index = 1; item = target.CreateMapping(); item.Assembly = "middle.dll"; target.InsertItem(index, item); Assert.AreEqual("middle.dll", tar[index].Assembly); }
public void ClearItemsTest() { PrivateObject param0 = CreateIniElement(); MappingCollection_Accessor target = new MappingCollection_Accessor(param0); MappingCollection tar = (MappingCollection)target.Target; tar.Clear(); IEnumerable<XElement> elements = from mappingNode in target.sessionFactoryEelement.Elements(xNamespace + "mapping") select mappingNode; XElement[] mappings = elements.ToArray<XElement>(); Assert.AreEqual(0, mappings.Length); Assert.AreEqual(0, tar.Count); }
public void RemoveItemTest() { PrivateObject param0 = CreateIniElement(); MappingCollection_Accessor target = new MappingCollection_Accessor(param0); // TODO: Initialize to an appropriate value int index = 0; target.RemoveItem(index); IEnumerable<XElement> elements = from mappingNode in target.sessionFactoryEelement.Elements(xNamespace + "mapping") select mappingNode; XElement[] mappings = elements.ToArray<XElement>(); Assert.AreEqual(0, mappings.Length); MappingCollection tar = (MappingCollection)target.Target; Assert.AreEqual(0, tar.Count); }
public void InsertItemTest_index0() { PrivateObject param0 = CreateIniElement(); MappingCollection_Accessor target = new MappingCollection_Accessor(param0); //Insert 第一位 int index = 0; Mapping item = target.CreateMapping(); item.Assembly = "ol.dll"; target.InsertItem(index, item); MappingCollection tar = (MappingCollection)target.Target; Assert.AreEqual<Int32>(2, tar.Count); Assert.AreEqual("ol.dll", tar[0].Assembly); //Insert 最后一位 item = target.CreateMapping(); item.Assembly = "ol1.dll"; index = tar.Count; target.InsertItem(index, item); Assert.AreEqual("ol1.dll", tar[2].Assembly); //insert 中间位置 index = 1; item = target.CreateMapping(); item.Assembly = "middle.dll"; target.InsertItem(index, item); Assert.AreEqual("middle.dll", tar[index].Assembly); }