public static EnglishMultimediaStatistic GetModel(Guid userId)
        {
            var completedEnglishMultimedia = CompletedEnglishMultimediaFactory.GetSimpleModels(20, userId);
            var multimediaStatistic        = new EnglishMultimediaStatistic(completedEnglishMultimedia);

            return(multimediaStatistic);
        }
        public async Task <UserStatisticAggregate> GetAsync(Guid userId)
        {
            EnglishMultimediaStatistic englishMultimediaStatistic = await _englishMultimediaStatisticRepository.GetByUserId(userId);

            EnglishTaskStatistic englishTaskStatistic = await _englishTaskStatisticRepository.GetByUserId(userId);

            var userStatisticAggregate = new UserStatisticAggregate(userId, englishMultimediaStatistic, englishTaskStatistic);

            return(userStatisticAggregate);
        }
        public static UserStatisticAggregate GetModel(Guid userId)
        {
            var completedEnglishMultimedia = CompletedEnglishMultimediaFactory.GetSimpleModels(20, userId);
            var completedTasks             = CompletedEnglishTaskFactory.GetSimpleModels(20, userId);
            var taskStatistic       = new EnglishTaskStatistic(completedTasks);
            var multimediaStatistic = new EnglishMultimediaStatistic(completedEnglishMultimedia);

            var userStatisticAggregate = new UserStatisticAggregate(userId, multimediaStatistic, taskStatistic);

            return(userStatisticAggregate);
        }
        public void GetPerVideoTypeStatistic_ReturnExpectedResult(
            IReadOnlyList <CompletedEnglishMultimedia> allMultimedia,
            IReadOnlyList <PerMultimediaContentTypeStatistic> expectedModels)
        {
            // Arrange
            var multimediaStatistic = new EnglishMultimediaStatistic(allMultimedia);

            // Act
            IReadOnlyList <PerMultimediaContentTypeStatistic> perMultimediaContentTypeStatistics = multimediaStatistic.GetPerVideoTypeStatistic();

            // Arrange
            perMultimediaContentTypeStatistics.Should().BeEquivalentTo(expectedModels);
        }
        public void GetFullStatistic_ReturnExpectedResult(
            Guid userId,
            EnglishMultimediaStatistic englishMultimediaStatistic,
            EnglishTaskStatistic englishTaskStatistic,
            FullStatistic expectedFullStatistic)
        {
            // Arrange
            var userStatisticAggregate = new UserStatisticAggregate(userId, englishMultimediaStatistic, englishTaskStatistic);

            // Act
            var fullStatistic = userStatisticAggregate.GetFullStatistic();

            // Arrange
            fullStatistic.Should().BeEquivalentTo(expectedFullStatistic);
        }
Пример #6
0
        public async Task GetPerVideoTypeStatisticByUserId_ReturnsExpectedResult(
            Guid userId,
            EnglishMultimediaStatistic multimediaStatistic,
            IReadOnlyList <PerMultimediaContentTypeStatisticModel> expectedResult)
        {
            // Arrange
            var applicationMapper             = new ApplicationMapper();
            var multimediaStatisticRepository = Substitute.For <IEnglishMultimediaStatisticRepository>();

            multimediaStatisticRepository
            .GetByUserId(Arg.Any <Guid>())
            .Returns(multimediaStatistic);

            var service = new EnglishMultimediaService(multimediaStatisticRepository, applicationMapper);

            // Act
            IReadOnlyList <PerMultimediaContentTypeStatisticModel> perContentTypeStatisticModels = await service.GetPerVideoTypeStatisticByUserId(userId);

            // Arrange
            perContentTypeStatisticModels.Should().BeEquivalentTo(expectedResult);
        }
        public static IEnumerable <object[]> GetFullStatistic_ReturnExpectedResult_Data()
        {
            var userId = Guid.NewGuid();
            var completedEnglishTask       = CompletedEnglishTaskFactory.GetSimpleModels(_random.Next(15, 25), userId);
            var completedEnglishMultimedia = CompletedEnglishMultimediaFactory.GetSimpleModels(_random.Next(15, 25), userId);

            var englishTaskStatistic       = new EnglishTaskStatistic(completedEnglishTask);
            var englishMultimediaStatistic = new EnglishMultimediaStatistic(completedEnglishMultimedia);
            var generalStatistic           = new GeneralStatistic(completedEnglishMultimedia, completedEnglishTask);

            var expectedFullStatistic = new FullStatistic
            {
                GroupedCompletedStatistic           = generalStatistic.GetAllCompleted(),
                PerDayStatistic                     = generalStatistic.GetPerDayForLastMonthStatistic(),
                PerTasksEnglishLevelsStatistic      = englishTaskStatistic.GetTasksPerEnglishLevelStatistic(),
                TasksCorrectnessStatistic           = englishTaskStatistic.GetTasksCorrectnessStatistic(),
                PerMultimediaEnglishLevelsStatistic = englishMultimediaStatistic.GetMultimediaPerEnglishLevelStatistic(),
                PerTextTypeStatistic                = englishMultimediaStatistic.GetPerTextTypeStatistic(),
                PerVideoTypeStatistic               = englishMultimediaStatistic.GetPerVideoTypeStatistic(),
            };

            yield return(new object[] { userId, englishMultimediaStatistic, englishTaskStatistic, expectedFullStatistic });
        }