public ActionResult Index() { AdminViewModelBuilder builder = new AdminViewModelBuilder(this.configService, this.golferService); ViewData.Model = builder.Build(); return View(); }
public void ShouldBuildCurrentYear() { this.InitServices(null, null); AdminViewModelBuilder builder = new AdminViewModelBuilder(configService, golferService); AdminViewModel viewModel = builder.Build(); Assert.Equal(viewModel.CurrentYear, 2009); }
public void ShouldLoadUnassignedGolfers() { List<Golfer> golfers = new List<Golfer>(); golfers.Add(new Golfer { FirstName = "Brett", LastName = "Bim" }); this.InitServices(golfers, null); AdminViewModelBuilder builder = new AdminViewModelBuilder(configService, golferService); AdminViewModel viewModel = builder.Build(); Assert.Equal(viewModel.GolferSections[0].SectionHeader, "Unassigned Golfers"); Assert.Equal(viewModel.GolferSections[0].Golfers.Count, 1); }
public ActionResult ConvertYear() { this.configService.ConvertYear(); AdminViewModelBuilder builder = new AdminViewModelBuilder(this.configService, this.golferService); AdminViewModel viewModel = builder.Build(); viewModel.Message = "Pool converted. . ."; ViewData.Model = viewModel; return View("Index"); }
public void ShouldRemoveParticipantsFromUnassigned() { List<Golfer> golfers = new List<Golfer>(); golfers.Add(new Golfer { FirstName = "Brett", LastName = "Bim", Id = 1}); List<MastersParticipant> participants = new List<MastersParticipant>(); participants.Add(new MastersParticipant {Golfer = golfers[0], GolferId = golfers[0].Id, MoneyGroup = 7}); this.InitServices(golfers, participants); AdminViewModelBuilder builder = new AdminViewModelBuilder(configService, golferService); AdminViewModel viewModel = builder.Build(); Assert.Equal(0, viewModel.GolferSections[0].Golfers.Count); Assert.Equal(1, viewModel.GolferSections[1].Golfers.Count); }