public void IsCategoryNameExist_Test() { //Arrange var categoryService = new CategoryService(); var trueCategory = new Category("true", 0); var fakeCategory = new Category("false", 1); categoryService.AddItem(trueCategory); //Act var trueOutput = categoryService.IsCategoryNameExist(trueCategory.Name); var falseOutput = categoryService.IsCategoryNameExist(fakeCategory.Name); //Assert trueOutput.Should().BeTrue(); falseOutput.Should().BeFalse(); }
public void GetCategoryById_Test() { //Arrange var categoryService = new CategoryService(); var trueCategory = new Category("trueName", 10); var falseCategory = new Category("falseName", 20); categoryService.AddItem(trueCategory); //Act var trueOutput = categoryService.GetCategoryById(10); var falseOutput = categoryService.GetCategoryById(20); //Assert trueOutput.Should().NotBeNull(); trueOutput.Should().BeOfType <Category>(); trueOutput.Id.Should().IsSameOrEqualTo(10); trueOutput.Name.Should().BeSameAs("trueName"); falseOutput.Should().BeNull(); categoryService.Items.Should().NotContain(falseCategory); }