Exemplo n.º 1
0
        public override void Given()
        {
            seasons = new List<Season>();

              activeSeason = new Season(name, GameType.EightBall);
              activeSeason.IsActive = true;
              seasons.Add(activeSeason);

              for (int i = 1; i <= inactiveCount; i++) {
            var season = new Season("other" + i.ToString(), GameType.EightBall);
            seasons.Add(season);
              }

              newActiveSeason = new Season("newactive", GameType.EightBall);
              newActiveSeason.SetIdTo(newActiveSeasonId);
              seasons.Add(newActiveSeason);

              repository.Setup(r => r.All<Season>()).Returns(seasons.AsQueryable());
              repository.Setup(r => r.SaveChanges()).Verifiable();
              repository.Setup(r => r.Get<Season>(newActiveSeasonId)).Returns(newActiveSeason);
        }
Exemplo n.º 2
0
        public override void Given()
        {
            viewModel = new CreateDivisionViewModel();
              viewModel.Name = "MyDivision";
              viewModel.StartingDate = DateTime.Parse("11/30/2010").ToShortDateString();
              viewModel.SeasonId = 1;

              var season = new Season("temp", GameType.EightBall);
              season.SetIdTo(viewModel.SeasonId);

              repository.Setup(r => r.Get<Season>(season.Id)).Returns(season);
              repository.Setup(r => r.All<Division>()).Returns(new List<Division>().AsQueryable());
              repository.Setup(r => r.SaveOrUpdate<Division>(It.IsAny<Division>())).Callback<Division>(d => savedDivision = d).Returns(savedDivision);
        }
Exemplo n.º 3
0
        public override void Given()
        {
            viewModel = new CreateDivisionViewModel();
              viewModel.Name = "MyDivision";
              viewModel.StartingDate = DateTime.Parse("11/30/2010").ToShortDateString();
              viewModel.SeasonId = 1;

              var season = new Season("temp", GameType.EightBall);
              var division = new Division(viewModel.Name, DateTime.Now, season);
              season.SetIdTo(viewModel.SeasonId);
              season.AddDivision(division);
              repository.Setup(r => r.Get<Season>(season.Id)).Returns(season);

              var divisions = new List<Division> { division };
              repository.Setup(r => r.All<Division>()).Returns(divisions.AsQueryable());
        }
Exemplo n.º 4
0
        public override void Given()
        {
            viewModel = new CreateTeamViewModel();
              viewModel.Name = name;
              viewModel.DivisionId = divisionId;

              var season = new Season("temp", GameType.EightBall);
              season.SetIdTo(1);
              var division = new Division("temp", DateTime.Now, season);
              division.SetIdTo(divisionId);

              repository.Setup(r => r.Get<Division>(divisionId)).Returns(division);
              repository.Setup(r => r.SaveOrUpdate<Team>(It.IsAny<Team>())).Callback<Team>(t => savedTeam = t).Returns(savedTeam);

              users = DomainModelHelper.GetUsers(5);
              repository.Init<User>(users.AsQueryable(), true);
        }
Exemplo n.º 5
0
        public override void Given()
        {
            viewModel = new CreateTeamViewModel();
              viewModel.DivisionId = divisionId;

              var season = new Season("temp", GameType.EightBall);
              season.SetIdTo(1);
              var division = new Division("temp", DateTime.Now, season);
              division.SetIdTo(1);

              repository.Setup(r => r.Get<Division>(divisionId)).Returns(division);

              users = DomainModelHelper.GetUsers(5);
              repository.Setup(r => r.SqlQuery<User>(It.IsAny<string>(), division.Season.Id)).Returns(users.AsQueryable());
              repository.Init<User>(users.AsQueryable(), true);

              controller.ModelState.AddModelError("Name", new Exception("test"));
        }
Exemplo n.º 6
0
        public override void Given()
        {
            viewModel = new CreateTeamViewModel();
              viewModel.Name = name;
              viewModel.DivisionId = divisionId;

              var season = new Season("temp", GameType.EightBall);
              season.SetIdTo(1);
              var division = new Division("temp", DateTime.Now, season);
              division.SetIdTo(1);
              division.AddTeam(new Team(name, division));
              repository.Setup(r => r.Get<Division>(divisionId)).Returns(division);

              users = DomainModelHelper.GetUsers(5);
              repository.Setup(r => r.SqlQuery<User>(It.IsAny<string>(), season.Id)).Returns(users.AsQueryable());
              repository.Init<User>(users.AsQueryable(), true);
              viewModel.SelectedPlayers = new int[1] { users[0].Id };
        }