Exemple #1
0
        public async Task GetTasksCorrectnessStatisticByUserId_ReturnsExpectedResult(
            Guid userId,
            EnglishTaskStatistic taskStatistic,
            TasksCorrectnessStatisticModel expectedResult)
        {
            // Arrange
            var applicationMapper       = new ApplicationMapper();
            var taskStatisticRepository = Substitute.For <IEnglishTaskStatisticRepository>();

            taskStatisticRepository
            .GetByUserId(Arg.Any <Guid>())
            .Returns(taskStatistic);

            var service = new EnglishTasksService(taskStatisticRepository, applicationMapper);

            // Act
            TasksCorrectnessStatisticModel correctnessStatistic = await service.GetTasksCorrectnessStatisticByUserId(userId);

            // Arrange
            correctnessStatistic.Should().BeEquivalentTo(expectedResult);
        }
Exemple #2
0
        public async Task GetPerEnglishLevelStatisticByUserId_ReturnsExpectedResult(
            Guid userId,
            EnglishTaskStatistic taskStatistic,
            IReadOnlyList <PerEnglishLevelStatisticModel> expectedResult)
        {
            // Arrange
            var applicationMapper       = new ApplicationMapper();
            var taskStatisticRepository = Substitute.For <IEnglishTaskStatisticRepository>();

            taskStatisticRepository
            .GetByUserId(Arg.Any <Guid>())
            .Returns(taskStatistic);

            var service = new EnglishTasksService(taskStatisticRepository, applicationMapper);

            // Act
            IReadOnlyList <PerEnglishLevelStatisticModel> perEnglishLevelModels = await service.GetPerEnglishLevelStatisticByUserId(userId);

            // Arrange
            perEnglishLevelModels.Should().BeEquivalentTo(expectedResult);
        }