Example #1
0
        public void ShouldCreateRatingWithError()
        {
            Rating expectedRating = new Rating
            {
                RatingValue = 5,
                Skip        = false,
            };

            DBResult <Rating> insertResult = new DBResult <Rating>
            {
                Payload = expectedRating,
                Status  = DBStatusCode.Error
            };

            Mock <IRatingDelegate> ratingDelegateMock = new Mock <IRatingDelegate>();

            ratingDelegateMock.Setup(s => s.InsertRating(It.Is <Rating>(r => r.RatingValue == expectedRating.RatingValue && r.Skip == expectedRating.Skip))).Returns(insertResult);

            IUserFeedbackService service = new UserFeedbackService(
                new Mock <ILogger <UserFeedbackService> >().Object,
                null,
                ratingDelegateMock.Object
                );

            RequestResult <Rating> actualResult = service.CreateRating(expectedRating);

            Assert.Equal(Common.Constants.ResultType.Error, actualResult.ResultStatus);
        }