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