public void SelectByIdTest() { OrderItem item = OrderItemTestData.CreateOrderItem1(); OrderItem find = this.Dao.SelectById(this.Context, item); Assert.AreEqual(item.Id, find.Id); OrderItemTestData.AssertAreEqual(item, find); }
public void SelectByIdTest() { OrderItem itemTest = OrderItemTestData.CreateOrderItem1(); OrderItem find = this.Service.SelectById(new OrderItem { Id = itemTest.Id }); Assert.IsNotNull(find); OrderItemTestData.AssertAreEqual(itemTest, find); }
public void UpdateTest() { OrderItem item = OrderItemTestData.CreateOrderItem1(); OrderItem beforeUpdate = this.Dao.SelectById(this.Context, item); Assert.IsNotNull(beforeUpdate); beforeUpdate.Name = string.Empty; this.Dao.Update(this.Context, beforeUpdate); OrderItem afterUpdate = this.Dao.SelectById(this.Context, beforeUpdate); OrderItemTestData.AssertAreEqual(beforeUpdate, afterUpdate); }
public void UpdateTest() { OrderItem itemTest = OrderItemTestData.CreateOrderItem1(); OrderItem beforeUpdate = this.Service.SelectById(new OrderItem { Id = itemTest.Id }); beforeUpdate.Name = string.Empty; this.Service.Update(beforeUpdate, true); OrderItem afterUpdate = this.Service.SelectById(new OrderItem { Id = itemTest.Id }); OrderItemTestData.AssertAreEqual(beforeUpdate, afterUpdate); }
public void SelectByTest() { OrderItem itemTest = OrderItemTestData.CreateOrderItem1(); List <OrderItem> find = this.Service.SelectBy(new OrderItem { Name = itemTest.Name }, new List <string> { "Name" }); Assert.IsNotNull(find); foreach (OrderItem item in find) { Assert.AreEqual(itemTest.Name, item.Name); } }
public void DeleteTest() { OrderItem item = OrderItemTestData.CreateOrderItem1(); OrderItem beforedelete = this.Dao.SelectById(this.Context, item); Assert.IsNotNull(beforedelete); int affectedRows = this.Dao.Delete(this.Context, beforedelete); Assert.AreEqual(1, affectedRows); OrderItem afterDelete = this.Dao.SelectById(this.Context, beforedelete); Assert.IsNull(afterDelete); List <OrderItem> items = this.Dao.SelectAll(this.Context); Assert.AreEqual(OrderItemTestData.OrderItemCount - 1, items.Count); }