public void FeedbackItemDataManager_DeleteFeedbackItem_CheckIfDBContainFourSettingAfterDeleting()
        {
            //arrange
            var feedbackItemRepository = new FeedbackItemRepository(_datacontext);
            FeedbackItemDataManager feedbackItemDataManager = new FeedbackItemDataManager(feedbackItemRepository);

            FeedbackItemData newFeedbackItem = new FeedbackItemData
               {
               FeedbackItemId = 5,
               Mandatory = false,
               SortNumber = 5,
               IsNumeric = false,
               FeedbackModelId = 2,
               NameTranslationKey = "NameTranslKey5",
               DescriptionTranslationKey = "DescrTranslation Key5"
               };

            //act
            feedbackItemDataManager.AddNewFeedbackItem(newFeedbackItem);
            var resultCountAfterAdding = feedbackItemDataManager.GetFeedbackItemsData().ToList().Count;
            feedbackItemDataManager.DeleteFeedbackItem(newFeedbackItem);
            var resultCountAfterDeleting = feedbackItemDataManager.GetFeedbackItemsData().ToList().Count;

            //assert
            Assert.AreEqual(6, resultCountAfterAdding);
            Assert.AreEqual(5, resultCountAfterDeleting);
        }
        public void FeedbackItemDataManager_DeleteFeedbackItem_DeleteNonExistingItem()
        {
            //arrange
            var feedbackItemRepository = new FeedbackItemRepository(_datacontext);
            FeedbackItemDataManager feedbackItemDataManager = new FeedbackItemDataManager(feedbackItemRepository);

            FeedbackItemData newFeedbackItem = new FeedbackItemData
            {
                FeedbackItemId = 50,
                Mandatory = false,
                SortNumber = 50,
                IsNumeric = false,
                FeedbackModelId = 2,
                NameTranslationKey = "NameTranslKey50",
                DescriptionTranslationKey = "DescrTranslation Key50"
            };

            //act
            //feedbackItemDataManager.AddNewFeedbackItem(newFeedbackItem);
            var resultCountBeforeDeleting = feedbackItemDataManager.GetFeedbackItemsData().ToList().Count;
            feedbackItemDataManager.DeleteFeedbackItem(newFeedbackItem);
            var resultCountAfterDeleting = feedbackItemDataManager.GetFeedbackItemsData().ToList().Count;

            //assert
            Assert.AreEqual(resultCountBeforeDeleting, resultCountAfterDeleting);
        }
Esempio n. 3
0
 /// <summary>
 /// Deletes the feedback item.
 /// </summary>
 /// <param name="feedbackItemForDelete">The feedback item for delete.</param>
 public void DeleteFeedbackItem(FeedbackItemData feedbackItemForDelete)
 {
     try
     {
         var feedbackManager = new FeedbackItemDataManager();
         feedbackManager.DeleteFeedbackItem(feedbackItemForDelete);
     }
     catch (Exception ex)
     {
         //TODO ADD tracking
     }
 }