public async Task GetAllReviewedEssayFromTecherCountTest() { var context = EssayCompetitionContextInMemoryFactory.InitializeContext(); var essay1 = await this.seeder.SeedGradedEssayAsync(context); var essay2 = await this.seeder.SeedGradedEssayAsync(context); await this.seeder.AddGradeAsync(context, essay1.Id); await this.seeder.AddGradeAsync(context, essay2.Id); var user1 = await this.seeder.SeedUserAsync(context, "*****@*****.**"); var essayTeacher1 = await this.seeder.SeedEssayTeacher(context, user1.Id, essay1.Id); var essayTeacher2 = await this.seeder.SeedEssayTeacher(context, user1.Id, essay2.Id); var essayRepository = new EfDeletableEntityRepository <Essay>(context); var categoryRepository = new EfDeletableEntityRepository <Category>(context); var gradeRepository = new EfRepository <Grade>(context); var essayTeacherRepository = new EfDeletableEntityRepository <EssayTeacher>(context); var service = new TeacherReviewedService(essayRepository, categoryRepository, gradeRepository, essayTeacherRepository); var result = service.GetAllReviewedEssayFromTecherCount(user1.Id); Assert.True(result == 2, "GetAllReviewedEssayFromTecherCount method does not work correctly"); }
public async Task HasEssayWithIdTest() { var context = EssayCompetitionContextInMemoryFactory.InitializeContext(); var essay = await this.seeder.SeedEssayAsync(context); var essayRepository = new EfDeletableEntityRepository <Essay>(context); var categoryRepository = new EfDeletableEntityRepository <Category>(context); var gradeRepository = new EfRepository <Grade>(context); var essayTeacherRepository = new EfDeletableEntityRepository <EssayTeacher>(context); var service = new TeacherReviewedService(essayRepository, categoryRepository, gradeRepository, essayTeacherRepository); var result = service.HasEssayWithId(essay.Id); Assert.True(result == true, "HasEssayWithId method does not work correctly"); }
public async Task GetEssayInfoTest() { var context = EssayCompetitionContextInMemoryFactory.InitializeContext(); var essay = await this.seeder.SeedEssayAsync(context); var essayRepository = new EfDeletableEntityRepository <Essay>(context); var categoryRepository = new EfDeletableEntityRepository <Category>(context); var gradeRepository = new EfRepository <Grade>(context); var essayTeacherRepository = new EfDeletableEntityRepository <EssayTeacher>(context); var service = new TeacherReviewedService(essayRepository, categoryRepository, gradeRepository, essayTeacherRepository); var essayInfo = service.GetEssayInfo <EssayViewModel>(essay.Id); Assert.True(essay.Id == essayInfo.Id, "GetEssayInfo method does not work correctly"); }