Пример #1
0
        internal async Task ValidateOnRate_RatingItemsWithDuplicatedRatings_ThrowsException(
            QuestionsAnswersRatingValidationService questionsAnswersRatingValidationService)
        {
            // Arrange
            var rating = new AnswersRating
            {
                AnswersAssessmentQuestion = new AnswersAssessmentQuestion
                {
                    Assessment = new Assessment
                    {
                        TestSession = new TestSession
                        {
                            State = TestSessionState.Assessment,
                        },
                    },
                },
            };
            var ratingItems = new List <QuestionsAnswersRatingItemData>
            {
                new QuestionsAnswersRatingItemData
                {
                    Rating = 1,
                },
                new QuestionsAnswersRatingItemData
                {
                    Rating = 1,
                },
            };

            // Act
            Func <Task> action = () => questionsAnswersRatingValidationService.ValidateOnRate(rating, ratingItems);

            // Assert
            await action.Should().ThrowAsync <InvalidOperationException>();
        }
Пример #2
0
        internal async Task ValidateOnRate_TestSessionInAssessmentPhase_Success(
            QuestionsAnswersRatingValidationService questionsAnswersRatingValidationService)
        {
            // Arrange
            var rating = new AnswersRating
            {
                AnswersAssessmentQuestion = new AnswersAssessmentQuestion
                {
                    Assessment = new Assessment
                    {
                        TestSession = new TestSession
                        {
                            State = TestSessionState.Assessment,
                        },
                    },
                },
            };
            var ratingItems = new List <QuestionsAnswersRatingItemData>();

            // Act
            Func <Task> action = () => questionsAnswersRatingValidationService.ValidateOnRate(rating, ratingItems);

            // Assert
            await action.Should().NotThrowAsync <InvalidOperationException>();
        }