Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }