Пример #1
0
        public void CheckCategoryName_ReturnsABoolOfValueFalse_WhenCalledAndProductCategoryNameIsNotInDatabase()
        {
            // Arrange
            bool   expected = false;
            string name     = "name";
            SqlServerCategoryRepository categoryRepo = new SqlServerCategoryRepository(context);

            // Act
            bool actual = categoryRepo.CheckCategoryName(name);

            // Assert
            Assert.AreEqual(expected, actual);
        }
Пример #2
0
        public void CheckCategoryName_ReturnsABoolOfValueTrue_WhenCalledAndProductCategoryNamePresentInDatabase()
        {
            // Arrange
            bool            expected = true;
            string          name     = "name";
            ProductCategory category = new ProductCategory();

            category.Id = 1;
            category.ProductCategoryName = "name";
            context.ProductCategories.Add(category);
            context.SaveChanges();
            SqlServerCategoryRepository categoryRepo = new SqlServerCategoryRepository(context);

            // Act
            bool actual = categoryRepo.CheckCategoryName(name);

            // Assert
            Assert.AreEqual(expected, actual);
        }