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);
        }
示例#2
0
        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);
        }
示例#4
0
        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 InsertTest()
        {
            Product item = new Product
            {
                Name        = string.Empty,
                Description = string.Empty,
            };
            int affectedRows = this.Dao.Insert(this.Context, item);

            Assert.AreEqual(1, affectedRows);

            Product find = this.Dao.SelectById(this.Context, item);

            ProductTestData.AssertAreEqual(item, find);

            List <Product> items = this.Dao.SelectAll(this.Context);

            Assert.AreEqual(ProductTestData.ProductCount + 1, items.Count);
        }