Example #1
0
        public async Task UpdateContestAsyncTest()
        {
            var context = EssayCompetitionContextInMemoryFactory.InitializeContext();

            await this.SeedData(context);

            var contestRepository           = new EfDeletableEntityRepository <Contest>(context);
            var essayRepository             = new EfDeletableEntityRepository <Essay>(context);
            var essayTeacherRepository      = new EfDeletableEntityRepository <EssayTeacher>(context);
            var contestantContestRepository = new EfDeletableEntityRepository <ContestantContest>(context);
            var service = new ContestService(contestRepository, essayRepository, essayTeacherRepository, contestantContestRepository);

            var contestId       = context.Contests.FirstOrDefault().Id;
            var contestCategory = context.Contests.FirstOrDefault().CategoryId;
            await service.UpdateContestAsync(DateTime.Now, DateTime.Now, "*", "*", contestCategory, contestId);

            var contestAfterName = service.GetContestName(contestId);

            Assert.True(contestAfterName == "*", "HasContesNow method does not work correctly");
        }