Exemplo n.º 1
0
        public void FeedbackItemDataManager_SetFeedbackItemsData_CheckIfDBContainUpdatedFeedbackItem()
        {
            //arrange
            var feedbackItemRepository = new FeedbackItemRepository(_datacontext);
            FeedbackItemDataManager feedbackItemDataManager = new FeedbackItemDataManager(feedbackItemRepository);
            FeedbackItemData newFeedbackItem = new FeedbackItemData
            {
                FeedbackItemId = 6,
                Mandatory = false,
                SortNumber = 5,
                IsNumeric = false,
                FeedbackModelId = 2,
                NameTranslationKey = "NameTranslKey5",
                DescriptionTranslationKey = "DescrTranslation Key5"
            };

            //act
            feedbackItemDataManager.AddNewFeedbackItem(newFeedbackItem);

            newFeedbackItem.Mandatory = true;
            newFeedbackItem.SortNumber = 100;
            newFeedbackItem.IsNumeric = true;
            newFeedbackItem.FeedbackModelId = 1;
            newFeedbackItem.NameTranslationKey = "NameTranslKey1";
            newFeedbackItem.DescriptionTranslationKey = "DescrTranslation Key1";

            feedbackItemDataManager.SetFeedbackItemsData(new List<FeedbackItemData>() { newFeedbackItem });
            var updatedList = feedbackItemDataManager.GetFeedbackItemsData().ToList();

            FeedbackItemData checkedFeedbackItem = updatedList.Single(x => x.FeedbackItemId == newFeedbackItem.FeedbackItemId);
            //assert

            Assert.AreEqual(6, updatedList.Count);
            Assert.AreEqual(newFeedbackItem.Mandatory, checkedFeedbackItem.Mandatory);
            Assert.AreEqual(newFeedbackItem.SortNumber, checkedFeedbackItem.SortNumber);
            Assert.AreEqual(newFeedbackItem.IsNumeric, checkedFeedbackItem.IsNumeric);
            Assert.AreEqual(newFeedbackItem.FeedbackModelId, checkedFeedbackItem.FeedbackModelId);
            Assert.AreEqual(newFeedbackItem.NameTranslationKey, checkedFeedbackItem.NameTranslationKey);
            Assert.AreEqual(newFeedbackItem.DescriptionTranslationKey, checkedFeedbackItem.DescriptionTranslationKey);
            Assert.AreEqual(newFeedbackItem.FeedbackItemId, checkedFeedbackItem.FeedbackItemId);
        }
Exemplo n.º 2
0
        public void FeedbackItemDataManager_SetFeedbackItemsData_UpdateNonExistingItem()
        {
            //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.SetFeedbackItemsData(new List<FeedbackItemData>() { newFeedbackItem });
        }
Exemplo n.º 3
0
 /// <summary>
 /// Sets the feedback items data.
 /// </summary>
 /// <param name="feedbackItemsDataList">The feedback items data list.</param>
 public void SetFeedbackItemsData(List<FeedbackItemData> feedbackItemsDataList)
 {
     try
     {
         var feedbackManager = new FeedbackItemDataManager();
         feedbackManager.SetFeedbackItemsData(feedbackItemsDataList);
     }
     catch (Exception ex)
     {
         //TODO ADD tracking
     }
 }