public async Task<Season> CreateSeason()
 {
     if (IsAdministrator)
     {
         var newSeason = new Season();
         Context.Add(newSeason);
         await Context.SaveChangesAsync();
         return newSeason;
     }
     else
     {
         throw new UnauthorizedAccessException();
     }
 }
        public async Task AddAchievementToSeason_ValidAchievement_AddsAndSaves()
        {
            Mock<IDbContext> fakeContext = new Mock<IDbContext>();
            fakeContext.SetAdmin(0);
            var season = new Season()
            {
                Id = 1,
                AchievementSeason = new List<SeasonalAchievement>(),
            };
            fakeContext.Setup(x => x.Get<Season>()).Returns(new Season[] { season }.AsQueryable());
            var seasonManager = new SeasonManager(fakeContext.Object, 0);

            await seasonManager.AddAchievementToSeason(1, 5, 0);

            fakeContext.Verify(x => x.SaveChangesAsync());
        }
        public async Task AddAchievementToSeason_Repeat_ThrowsExceptions()
        {
            Mock<IDbContext> fakeContext = new Mock<IDbContext>();
            fakeContext.SetAdmin(0);
            var season = new Season()
            {
                Id = 1,
                AchievementSeason = new [] { new SeasonalAchievement
                {
                    SeasonId = 1,
                    AchievementId = 10,
                } },
            };
            fakeContext.Setup(x => x.Get<Season>()).Returns(new Season[] { season }.AsQueryable());
            var seasonManager = new SeasonManager(fakeContext.Object, 0);

            await seasonManager.AddAchievementToSeason(1, 10, 0);

            fakeContext.Verify(x => x.SaveChangesAsync(), Times.Never());
        }