Exemple #1
0
        public void GetCategoryById_ReturnsADefaultProductCategoriyOfIdValueOfZero_WhenCalledWithValidIdOfValueOneButDatabaseIsEmpty()
        {
            // Arrange
            int expected = 0;
            int id       = 1;
            SqlServerCategoryRepository categoryRepo = new SqlServerCategoryRepository(context);

            // Act
            int actual = categoryRepo.GetCategoryById(id).Id;

            // Assert
            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public void GetCategoryById_ReturnsAProductCategoriyOfIdValueOfOne_WhenCalledWithValidIdOfValueOnePresentInDatabase()
        {
            // Arrange
            int expected = 1;
            int id       = 1;

            InsertData();
            SqlServerCategoryRepository categoryRepo = new SqlServerCategoryRepository(context);

            // Act
            int actual = categoryRepo.GetCategoryById(id).Id;

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