public void DeleteCategory_InvalidId_ReturnsFalse() { var service = new EntityMapping.DataService(); var result = service.DeleteCategory(-1); Assert.False(result); }
public void DeleteCategory_ValidId_RemoveTheCategory() { var service = new EntityMapping.DataService(); var category = (EntityMapping.Category)service.CreateCategory("Test", "DeleteCategory_ValidId_RemoveTheCategory"); var result = service.DeleteCategory(category.Id); Assert.True(result); category = (EntityMapping.Category)service.GetCategory(category.Id); Assert.Null(category); }
public void CreateCategory_ValidData_CreteCategoryAndRetunsNewObject() { var service = new EntityMapping.DataService(); var category = (EntityMapping.Category)service.CreateCategory("Test", "CreateCategory_ValidData_CreteCategoryAndRetunsNewObject"); Assert.True(category.Id > 0); Assert.Equal("Test", category.Name); Assert.Equal("CreateCategory_ValidData_CreteCategoryAndRetunsNewObject", category.Description); // cleanup service.DeleteCategory(category.Id); }
public void UpdateCategory_NewNameAndDescription_UpdateWithNewValues() { var service = new EntityMapping.DataService(); var category = (EntityMapping.Category)service.CreateCategory("TestingUpdate", "UpdateCategory_NewNameAndDescription_UpdateWithNewValues"); var result = service.UpdateCategory(category.Id, "UpdatedName", "UpdatedDescription"); Assert.True(result); category = (EntityMapping.Category)service.GetCategory(category.Id); Assert.Equal("UpdatedName", category.Name); Assert.Equal("UpdatedDescription", category.Description); // cleanup service.DeleteCategory(category.Id); }