public void ShouldUpdateShipper() { // Arrange using (SqlProvider provider = new SqlProvider(ConfigSettings.SqlConnectionString)) { Shipper shipper = DataProvider.PreInsertArrange(provider); provider.Insert<Shipper>(shipper); shipper.CompanyName += " Changed"; shipper.ShipperContacts[0].EmailAddress += shipper.ShipperContacts[0].EmailAddress + " Changed"; // Act provider.Update<Shipper>(shipper); // Assert Shipper updatedShipper = provider.SelectById<Shipper>(shipper.Id); Assert.AreEqual(shipper.CompanyName, updatedShipper.CompanyName); Assert.AreEqual(shipper.ShipperContacts[0].EmailAddress, updatedShipper.ShipperContacts[0].EmailAddress); } }
public void ShouldDeleteAll() { // Arrange using (SqlProvider provider = new SqlProvider(ConfigSettings.SqlConnectionString)) { Shipper shipper = DataProvider.PreInsertArrange(provider); provider.Insert<Shipper>(shipper); // Act provider.DeleteAll<Shipper>(); // Assert Assert.IsNull(provider.SelectById<Shipper>(shipper.Id)); Assert.IsNull(provider.SelectById<Shipper>(shipper.ShipperContacts[0].Id)); } }
public void ShouldSelectShipperAndTree() { // Arrange using (SqlProvider provider = new SqlProvider(ConfigSettings.SqlConnectionString)) { Shipper shipper = DataProvider.PreInsertArrange(provider); shipper = provider.Insert<Shipper>(shipper); // Act Shipper savedTree = provider.SelectById<Shipper>(shipper.Id); // Assert Assert.IsNotNull(savedTree); Assert.AreEqual(savedTree.ShipperContacts.Count, 1); Assert.IsNotNull(savedTree.ShipperContacts[0]); } }