public static IEnumerable <object[]> GetAllCompleted_ReturnExpectedResult_Data() { var dates = DateTimeFactory.GetRandomDateTimes(10); var multimediaPerDay = new Dictionary <DateTime, IReadOnlyList <CompletedEnglishMultimedia> >(); var tasksPerDay = new Dictionary <DateTime, IReadOnlyList <CompletedEnglishTask> >(); foreach (var date in dates) { multimediaPerDay[date] = CompletedEnglishMultimediaFactory.GetSimpleModels(_random.Next(1, 8), date: date); tasksPerDay[date] = CompletedEnglishTaskFactory.GetSimpleModels(_random.Next(1, 8), date: date); } var allMultimedias = multimediaPerDay.SelectMany(x => x.Value).ToList(); var allTasks = tasksPerDay.SelectMany(x => x.Value).ToList(); var expectedModels = new List <GroupedCompletedStatistic>(); foreach (var date in dates) { var statisticDate = new StatisticDate(date.Day, date.Month, date.Year); var completedByDay = multimediaPerDay[date] .OfType <CompletedStatistic>() .Concat(tasksPerDay[date]) .ToList(); var groupedCompletedStatistic = new GroupedCompletedStatistic(statisticDate, completedByDay); expectedModels.Add(groupedCompletedStatistic); } yield return(new object[] { allMultimedias, allTasks, expectedModels }); }
public static EnglishTaskStatistic GetModel(Guid userId) { var completedEnglishTasks = CompletedEnglishTaskFactory.GetSimpleModels(20, userId); var taskStatistic = new EnglishTaskStatistic(completedEnglishTasks); return(taskStatistic); }
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 static IEnumerable <object[]> GetPerDayForLastMonthStatistic_ReturnExpectedResult_Data() { var userId = Guid.NewGuid(); var dates = DateTimeFactory.GetDateSequence(DateTime.Now, 60); var videosPerDay = new Dictionary <DateTime, IReadOnlyList <CompletedEnglishMultimedia> >(); var textsPerDay = new Dictionary <DateTime, IReadOnlyList <CompletedEnglishMultimedia> >(); var tasksPerDay = new Dictionary <DateTime, IReadOnlyList <CompletedEnglishTask> >(); foreach (var date in dates) { videosPerDay[date] = CompletedEnglishMultimediaFactory.GetSimpleModels(_random.Next(1, 5), date: date, multimediaType: MultimediaType.Video); textsPerDay[date] = CompletedEnglishMultimediaFactory.GetSimpleModels(_random.Next(1, 5), date: date, multimediaType: MultimediaType.Text); tasksPerDay[date] = CompletedEnglishTaskFactory.GetSimpleModels(_random.Next(1, 5), date: date); } var allMultimedias = videosPerDay .SelectMany(x => x.Value) .Concat(textsPerDay.SelectMany(x => x.Value)) .ToList(); var allTasks = tasksPerDay.SelectMany(x => x.Value).ToList(); var expectedModels = new List <PerDayStatistic>(); for (var i = 0; i < 31; i++) { var date = dates[i]; var statisticDate = new StatisticDate(date.Day, date.Month, date.Year); var perDayStatistic = new PerDayStatistic() { Date = new StatisticDate(date.Day, date.Month, date.Year), CompletedTasksCount = tasksPerDay[date].Count, CompletedTextCount = textsPerDay[date].Count, CompletedVideoCount = videosPerDay[date].Count, }; expectedModels.Add(perDayStatistic); } yield return(new object[] { allMultimedias, allTasks, expectedModels }); }
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 }); }
public static IEnumerable <object[]> GetTasksPerEnglishLevelStatistic_ReturnExpectedResult_Data() { var englishLevels = EnglishLevelFactory.EnglishLevels; var tasksPerLevel = new Dictionary <string, IReadOnlyList <CompletedEnglishTask> >(); foreach (var englishLevel in englishLevels) { tasksPerLevel[englishLevel] = CompletedEnglishTaskFactory.GetSimpleModels(_random.Next(1, 8), englishLevel: englishLevel); } var allTasks = tasksPerLevel.SelectMany(x => x.Value).ToList(); var expectedModels = new List <PerEnglishLevelStatistic>(); foreach (var englishLevel in englishLevels) { var levelStatistic = new PerEnglishLevelStatistic(englishLevel, tasksPerLevel[englishLevel].Count); expectedModels.Add(levelStatistic); } yield return(new object[] { allTasks, expectedModels }); }
public static IEnumerable <object[]> GetTasksCorrectnessStatistic_ReturnExpectedResult_Data() { var itemsPerTask = 10; var tasksCount = 20; var allTasks = new List <CompletedEnglishTask>(); double correctPercentage = 0; double incorrectPercentage = 0; for (var i = 0; i < tasksCount; i++) { var correctAnswers = _random.Next(1, itemsPerTask - 2); var incorrectAnswers = itemsPerTask - correctAnswers; var task = CompletedEnglishTaskFactory.GetSimpleModel(itemsPerTask: itemsPerTask, correctAnswers: correctAnswers, incorrectAnswers: incorrectAnswers); allTasks.Add(task); correctPercentage += (double)correctAnswers / itemsPerTask; incorrectPercentage += (double)incorrectAnswers / itemsPerTask; } var expectedModel = new TasksCorrectnessStatistic(correctPercentage / tasksCount, incorrectPercentage / tasksCount); yield return(new object[] { allTasks, expectedModel }); }