Esempio n. 1
0
        public void SaveTestExistingChangeUpdatedBy()
        {
            // Arrange
            var user         = new UserRepository(context).FindByEmail("*****@*****.**");
            var itemCategory = itemCategoryRepository.FindById(2);
            var original     = itemCategory.UpdatedBy;

            itemCategory.UpdatedBy = user;

            // Act
            var result = itemCategoryRepository.Save(itemCategory);

            // Assert
            Assert.AreEqual(user, result.UpdatedBy);

            // Tear Down
            itemCategory.UpdatedBy = original;
            itemCategoryRepository.Save(itemCategory);
        }
        public void TestInitialize()
        {
            context                = new ApplicationDbContext();
            itemRepository         = new ItemRepository(context);
            itemcategoryService    = new ItemCategoryService(context);
            itemcategoryRepository = new ItemCategoryRepository(context);

            //create new ItemCategory object and save into DB
            ItemCategory ic = itemcategoryRepository.Save(new ItemCategory()
            {
                ItemCategoryId  = IdService.GetNewItemCategoryId(context),
                Name            = "TEST",
                CreatedDateTime = DateTime.Now
            });
        }
 public ItemCategory Save(ItemCategory itemCategory)
 {
     return(itemCategoryRepository.Save(itemCategory));
 }