public void InsertAll_Test() { using var context = new ContextTest(); var family1 = new Family { FamilyName = "Deligans" }; context.Insert(family1); var listParent = new List <Parent>(); var parent1 = new Parent { FamilyId = family1.Id, FirstName = family1.FamilyName, LastName = "Fabien", }; var parent2 = new Parent { FamilyId = family1.Id, FirstName = family1.FamilyName, LastName = "Sandrine", }; listParent.AddRange(new[] { parent1, parent2 }); context.InsertAll(listParent); var listParentDatabase = context.QueryCollection <Parent>(); Assert.AreEqual(2, listParentDatabase.Count()); }
public void Update_Test() { using var context = new ContextTest(); var family1 = new Family { FamilyName = "Deligans" }; context.Insert(family1); var listParent = new List <Parent>(); var parent1 = new Parent { FamilyId = family1.Id, FirstName = family1.FamilyName, LastName = "Fabien", }; var parent2 = new Parent { FamilyId = family1.Id, FirstName = family1.FamilyName, LastName = "Sandrine", }; listParent.AddRange(new[] { parent1, parent2 }); context.InsertAll(listParent); var newFirstName = "Paulat"; context.UpdateProperty(parent2, nameof(Parent.FirstName), newFirstName); var newParent2 = context.GetEntity <Parent>(parent2.Id); Assert.AreEqual(newFirstName, newParent2.FirstName); }