Esempio n. 1
0
        public void SaveBlindSpotNotificationTest()
        {
            //arrange
            var request = new BlindSpotNotification
            {
                coworkerid = new List <string>
                {
                    "1", "2", "3"
                },
                userid = ""
            };
            var response = new List <Feedback>
            {
                new Feedback {
                }
            };
            var settings = new MongoDbSettings {
                FeedbackCollection = "", FeedbackReplyCollection = ""
            };

            _settings.Setup(s => s.Value).Returns(settings);
            _mokgetFeedbackDetailsAdapter.Setup(a => a.GetLastAddedFeedback()).Returns(1);
            _mokstoreFeedbackAdapter.Setup(a => a.SaveFeedbackQuestion(It.IsAny <Feedback>()));
            //act
            var feedbackAdapter = new FeedbackBusinessLogics(_mokstoreFeedbackAdapter.Object, _mokgetFeedbackDetailsAdapter.Object);

            feedbackAdapter.SaveBlindSpotNotification(request);

            //assert
            _mokgetFeedbackDetailsAdapter.Verify(a => a.GetLastAddedFeedback());
            _mokstoreFeedbackAdapter.Verify(a => a.SaveFeedbackQuestion(It.IsAny <Feedback>()));
        }
Esempio n. 2
0
        public void SaveFeedbackReplyTest()
        {
            //arrange
            var request  = new FeedbackReply();
            var response = new List <Feedback>
            {
                new Feedback {
                }
            };
            var settings = new MongoDbSettings {
                FeedbackCollection = "", FeedbackReplyCollection = ""
            };

            _settings.Setup(s => s.Value).Returns(settings);
            _mokgetFeedbackDetailsAdapter.Setup(a => a.GetLastAddedFeedbackReply()).Returns(1);
            _mokstoreFeedbackAdapter.Setup(a => a.SaveFeedbackReply(It.IsAny <FeedbackReply>()));
            //act
            var feedbackAdapter = new FeedbackBusinessLogics(_mokstoreFeedbackAdapter.Object, _mokgetFeedbackDetailsAdapter.Object);

            feedbackAdapter.SaveFeedbackReply(request);

            //assert
            _mokgetFeedbackDetailsAdapter.Verify(a => a.GetLastAddedFeedbackReply(), Times.Once);
            _mokstoreFeedbackAdapter.Verify(a => a.SaveFeedbackReply(It.IsAny <FeedbackReply>()), Times.Once);
        }
Esempio n. 3
0
        public void UpdateOrAddFeedbacksByAdminTestForIdIsNotZero()
        {
            //arrange
            var request = new List <Feedback>
            {
                new Feedback {
                    id = 1, assigned = "yes"
                }
            };
            var response = new List <Feedback>
            {
                new Feedback {
                }
            };
            var settings = new MongoDbSettings {
                FeedbackCollection = "", FeedbackReplyCollection = ""
            };

            _settings.Setup(s => s.Value).Returns(settings);
            _mokgetFeedbackDetailsAdapter.Setup(a => a.GetLastAddedFeedback()).Returns(1);
            _mokstoreFeedbackAdapter.Setup(a => a.UpdateFeedbackAssigned(It.IsAny <Feedback>()));
            //act
            var feedbackAdapter = new FeedbackBusinessLogics(_mokstoreFeedbackAdapter.Object, _mokgetFeedbackDetailsAdapter.Object);

            feedbackAdapter.UpdateOrAddFeedbacksByAdmin(request);

            //assert
            _mokgetFeedbackDetailsAdapter.Verify(a => a.GetLastAddedFeedback());
            _mokstoreFeedbackAdapter.Verify(a => a.UpdateFeedbackAssigned(It.IsAny <Feedback>()));
        }
Esempio n. 4
0
        public void UpdateFeedbackStatusTest()
        {
            //arrange
            var settings = new MongoDbSettings {
                FeedbackCollection = "", FeedbackReplyCollection = ""
            };

            _settings.Setup(s => s.Value).Returns(settings);
            //act
            var feedbackAdapter = new FeedbackBusinessLogics(_mokstoreFeedbackAdapter.Object, _mokgetFeedbackDetailsAdapter.Object);

            feedbackAdapter.UpdateFeedbackStatus(1);

            //assert
            _mokstoreFeedbackAdapter.Verify(a => a.UpdateFeedbackStatus(It.IsAny <long>()));
        }
Esempio n. 5
0
        public void GetAdminCommentsTest()
        {
            //arrange
            var response = new List <Feedback>();
            var settings = new MongoDbSettings {
                FeedbackCollection = "", FeedbackReplyCollection = ""
            };

            _settings.Setup(s => s.Value).Returns(settings);
            _mokgetFeedbackDetailsAdapter.Setup(a => a.GetFeedBacksAssignedToUser(It.IsAny <string>())).Returns(response);
            //act
            var feedbackAdapter = new FeedbackBusinessLogics(_mokstoreFeedbackAdapter.Object, _mokgetFeedbackDetailsAdapter.Object);
            var result          = feedbackAdapter.GetAdminComments("1");

            //assert
            _mokgetFeedbackDetailsAdapter.Verify(a => a.GetFeedBacksAssignedToUser(It.IsAny <string>()));
            Assert.IsInstanceOf <List <Feedback> >(result);
        }
Esempio n. 6
0
        public void GetFeedbackDetailsForAdminTest()
        {
            //arrange
            var request  = new Feedback();
            var response = new List <Feedback>
            {
                new Feedback {
                }
            };
            var settings = new MongoDbSettings {
                FeedbackCollection = "", FeedbackReplyCollection = ""
            };

            _settings.Setup(s => s.Value).Returns(settings);
            _mokgetFeedbackDetailsAdapter.Setup(a => a.GetAllPendingFeedbacks()).Returns(new List <Feedback>());
            //act
            var feedbackAdapter = new FeedbackBusinessLogics(_mokstoreFeedbackAdapter.Object, _mokgetFeedbackDetailsAdapter.Object);
            var result          = feedbackAdapter.GetFeedbackDetailsForAdmin();

            //assert
            Assert.IsInstanceOf <List <Feedback> >(result);
        }
Esempio n. 7
0
        public void GetNotificationCountTest()
        {
            //arrange
            var request = new BlindSpotNotification
            {
                coworkerid = new List <string>
                {
                    "1", "2", "3"
                },
                userid = ""
            };
            var response = new List <Feedback>
            {
                new Feedback {
                    id = 1
                }
            };
            var feedbackreplyresponse = new FeedbackReply
            {
                feedback = "feedback"
            };
            var settings = new MongoDbSettings {
                FeedbackCollection = "", FeedbackReplyCollection = ""
            };

            _settings.Setup(s => s.Value).Returns(settings);
            _mokgetFeedbackDetailsAdapter.Setup(a => a.GetFeedBacksAssignedToUser(It.IsAny <string>())).Returns(response);
            _mokgetFeedbackDetailsAdapter.Setup(a => a.GetFeedbackRequestsByUser(It.IsAny <string>())).Returns(response);
            _mokgetFeedbackDetailsAdapter.Setup(a => a.GetFeedbackReplyForQuestion(It.IsAny <long>())).Returns(feedbackreplyresponse);
            //act
            var feedbackAdapter = new FeedbackBusinessLogics(_mokstoreFeedbackAdapter.Object, _mokgetFeedbackDetailsAdapter.Object);
            var result          = feedbackAdapter.GetNotificationCount("1");

            //assert
            _mokgetFeedbackDetailsAdapter.Verify(a => a.GetFeedBacksAssignedToUser(It.IsAny <string>()));
            _mokgetFeedbackDetailsAdapter.Verify(a => a.GetFeedbackRequestsByUser(It.IsAny <string>()));
            _mokgetFeedbackDetailsAdapter.Verify(a => a.GetFeedbackReplyForQuestion(It.IsAny <long>()));
            Assert.IsInstanceOf <long>(result);
        }