Esempio n. 1
0
        public void WhenAthleteListProvider_SetAthletesAndGetUpdatedAtheleViewModelCalledWithStatusStop_ANonEmptyAthleteViewModelWithFinishedShuttleIsReturned()
        {
            Mock <IRepository <Shuttle> > shuttleRepository = new Mock <IRepository <Shuttle> >();
            Mock <IRepository <Athlete> > athleteRepository = new Mock <IRepository <Athlete> >();

            shuttleRepository.Setup(x => x.GetAll()).Returns(GetTestShuttleData());

            athleteRepository.Setup(x => x.GetAll()).Returns(GetTestAthleteData());
            AthleteShuttleServices athleteShuttleServices = new AthleteShuttleServices(
                shuttleRepository.Object,
                athleteRepository.Object);
            AthleteListProvider athleteListProvider = new AthleteListProvider();

            athleteListProvider.SetAthletes(athleteShuttleServices.GetAllAthletes());

            athleteListProvider.SetShuttles(athleteShuttleServices.GetAllShuttles());

            var viewModel = athleteListProvider.GetUpdatedAtheleViewModel(1, "stop", 8, 20);

            Assert.NotNull(viewModel);

            Assert.True(viewModel.Athletes.FirstOrDefault(x => x.ShuttleState.Equals("stop")).FinishedShuttles.Count() > 0);
        }
Esempio n. 2
0
        public void WhenAthleteListProvider_SetAthletesAndUpdateTestResultForAnAthleteCalledWithStatusWarn_ANonEmptyAthleteViewModelIsReturned()
        {
            Mock <IRepository <Shuttle> > shuttleRepository = new Mock <IRepository <Shuttle> >();
            Mock <IRepository <Athlete> > athleteRepository = new Mock <IRepository <Athlete> >();

            shuttleRepository.Setup(x => x.GetAll()).Returns(GetTestShuttleData());

            athleteRepository.Setup(x => x.GetAll()).Returns(GetTestAthleteData());
            AthleteShuttleServices athleteShuttleServices = new AthleteShuttleServices(
                shuttleRepository.Object,
                athleteRepository.Object);
            AthleteListProvider athleteListProvider = new AthleteListProvider();

            athleteListProvider.SetAthletes(athleteShuttleServices.GetAllAthletes());

            athleteListProvider.SetShuttles(athleteShuttleServices.GetAllShuttles());


            var viewModel = athleteListProvider.UpdateTestResultForAnAthlete(1, "warn", 8, 20);

            Assert.NotNull(viewModel);

            Assert.True(viewModel.Athletes.Where(x => x.ShuttleState.Equals("warn")).Count() > 0);
        }