public void GetByIDTest() { ICategoryService _categoryService = new CategoryService(new CategoryRepository(), new CategoryFilterFactory()); CategoryViewModel _categoryViewModel = GetCategoryViewModel(); _categoryService.Add(_categoryViewModel); Assert.IsNotNull(_categoryService.GetByID(1)); }
public void EditTest() { ICategoryService _categoryService = new CategoryService(new CategoryRepository(), new CategoryFilterFactory()); CategoryViewModel _categoryViewModel = GetCategoryViewModel(); _categoryService.Add(_categoryViewModel); _categoryViewModel.Description = "otherDescription"; _categoryService.Edit(_categoryViewModel); bool actual, expected = true; if(_categoryService.GetByID(1).Description.CompareTo("otherDescription") == 0) { actual = true; } else { actual = false; } Assert.AreEqual(expected, actual); }