Esempio n. 1
0
        public void PostCate_Success()
        {
            // get MOCK
            var mapper = MapperMock.Get();
            // initial mock data
            var dbContext = _fixture.Context;

            dbContext.TypeProducts.Add(new TypeProduct {
                Name = "Product Type"
            });
            // create dependency
            var cateDao = new CategoryDAO(dbContext);
            // test
            var category = new Category {
                Name = "Product Category Post", TypeProductId = 1
            };
            var result = cateDao.AddItem(category);

            var createAtAction = Assert.IsType <CategoryVM>(result);

            Assert.Equal("Product Category Post", createAtAction.Name);
        }