public void AddSimpleTypeSaveAndLoad() { // Setup var file = GetXmlFile(nameof(AddSimpleTypeSaveAndLoad)); File.Delete(file); var set = new XmlSet <SimpleType>(file); // Execute var simple = new SimpleType { Name = "Test", Value = 12.35, Price = 4.50m, Date = DateTime.Parse("9/1/2015") }; set.Add(simple); set.Save(); var set2 = new XmlSet <SimpleType>(file); var result = set2.First(); // Assert Assert.AreEqual(simple.Name, result.Name); Assert.AreEqual(simple.Value, result.Value); Assert.AreEqual(simple.Price, result.Price); Assert.AreEqual(simple.Date, result.Date); }
public void AddComplexTypeSaveAndLoad() { // Setup var file = GetXmlFile(nameof(AddComplexTypeSaveAndLoad)); File.Delete(file); var set = new XmlSet<ComplexType>(file); // Execute var complex = new ComplexType { Description = "This is a test", Size = 42, Child = new SimpleType { Name = "Test", Value = 12.35, Price = 4.50m, Date = DateTime.Parse("9/1/2015") } }; set.Add(complex); set.Save(); var set2 = new XmlSet<ComplexType>(file); var result = set2.First(); // Assert Assert.AreEqual(complex.Description, result.Description); Assert.AreEqual(complex.Size, result.Size); Assert.IsNotNull(complex.Child); Assert.AreEqual(complex.Child.Name, result.Child.Name); Assert.AreEqual(complex.Child.Value, result.Child.Value); Assert.AreEqual(complex.Child.Price, result.Child.Price); Assert.AreEqual(complex.Child.Date, result.Child.Date); }
public void RevertSet() { // Setup up. var file = GetXmlFile(nameof(RevertSet)); File.Delete(file); var set = new XmlSet <SimpleType>(file); var simple = new SimpleType { Name = "Test", Value = 12.35, Price = 4.50m, Date = DateTime.Parse("9/1/2015") }; set.Add(simple); set.Save(); var simple2 = new SimpleType { Name = "Test 2", Value = 43.001, Price = 8.5m, Date = DateTime.Parse("9/2/2015") }; // Execute set.Revert(); // Assert Assert.AreEqual(1, set.Count); Assert.AreEqual(simple.Name, set.First().Name); }
public void AddEntityWithNull() { // Setup var file = GetXmlFile(nameof(AddEntityWithNull)); var set = new XmlSet <SimpleType>(file); // Execute set.Add(a_entity: null); }
public void AddEntityWithNull() { // Setup var file = GetXmlFile(nameof(AddEntityWithNull)); var set = new XmlSet<SimpleType>(file); // Execute set.Add(a_entity: null); }
public void AddEntity() { // Setup var file = GetXmlFile(nameof(AddEntity)); var set = new XmlSet <SimpleType>(file); var simpleType = new SimpleType(); // Execute set.Add(simpleType); // Assert Assert.AreSame(simpleType, set.First()); Assert.AreEqual(1, set.Count); }
public void AddEntity() { // Setup var file = GetXmlFile(nameof(AddEntity)); var set = new XmlSet<SimpleType>(file); var simpleType = new SimpleType(); // Execute set.Add(simpleType); // Assert Assert.AreSame(simpleType, set.First()); Assert.AreEqual(1, set.Count); }
public void AddComplexTypeSaveAndLoad() { // Setup var file = GetXmlFile(nameof(AddComplexTypeSaveAndLoad)); File.Delete(file); var set = new XmlSet <ComplexType>(file); // Execute var complex = new ComplexType { Description = "This is a test", Size = 42, Child = new SimpleType { Name = "Test", Value = 12.35, Price = 4.50m, Date = DateTime.Parse("9/1/2015") } }; set.Add(complex); set.Save(); var set2 = new XmlSet <ComplexType>(file); var result = set2.First(); // Assert Assert.AreEqual(complex.Description, result.Description); Assert.AreEqual(complex.Size, result.Size); Assert.IsNotNull(complex.Child); Assert.AreEqual(complex.Child.Name, result.Child.Name); Assert.AreEqual(complex.Child.Value, result.Child.Value); Assert.AreEqual(complex.Child.Price, result.Child.Price); Assert.AreEqual(complex.Child.Date, result.Child.Date); }
public void AddSimpleTypeSaveAndLoad() { // Setup var file = GetXmlFile(nameof(AddSimpleTypeSaveAndLoad)); File.Delete(file); var set = new XmlSet<SimpleType>(file); // Execute var simple = new SimpleType { Name = "Test", Value = 12.35, Price = 4.50m, Date = DateTime.Parse("9/1/2015") }; set.Add(simple); set.Save(); var set2 = new XmlSet<SimpleType>(file); var result = set2.First(); // Assert Assert.AreEqual(simple.Name, result.Name); Assert.AreEqual(simple.Value, result.Value); Assert.AreEqual(simple.Price, result.Price); Assert.AreEqual(simple.Date, result.Date); }
public void RevertSet() { // Setup up. var file = GetXmlFile(nameof(RevertSet)); File.Delete(file); var set = new XmlSet<SimpleType>(file); var simple = new SimpleType { Name = "Test", Value = 12.35, Price = 4.50m, Date = DateTime.Parse("9/1/2015") }; set.Add(simple); set.Save(); var simple2 = new SimpleType { Name = "Test 2", Value = 43.001, Price = 8.5m, Date = DateTime.Parse("9/2/2015") }; // Execute set.Revert(); // Assert Assert.AreEqual(1, set.Count); Assert.AreEqual(simple.Name, set.First().Name); }