Exemplo n.º 1
0
        public CoachTextDto ChampionshipTextPreparation(TournamentTeamDto dto)
        {
            var details = PrepareChampionshipDetails(dto);

            CoachTextDto textdto = new CoachTextDto
            {
                SportId  = 4,
                TeamId   = dto.TeamId,
                Selected = true,
                Message  = PrepareChampionshipText(details)
            };


            return(textdto);
        }
Exemplo n.º 2
0
        public CoachEmailDto ChampionshipEmailPreparation(TournamentTeamDto dto)
        {
            var details = PrepareChampionshipDetails(dto);

            CoachEmailDto emailDto = new CoachEmailDto
            {
                SportId     = 4,
                TeamId      = dto.TeamId,
                Selected    = true,
                From        = "*****@*****.**",
                Subject     = "Basketball Tournament Information",
                HtmlContent = PrepareChampionshipEmail(details)
            };

            return(emailDto);
        }
Exemplo n.º 3
0
        public TournamentDetails PrepareChampionshipDetails(TournamentTeamDto dto)
        {
            var location = _referenceRepository.GetLocationByLocationId(dto.LocationId);
            var details  = new TournamentDetails
            {
                FirstGameTime   = _referenceRepository.GetTimeByTimeId(dto.Game1TimeId).Result.TimeHour,
                LocationAddress = location.Result.Street,
                LocationCity    = location.Result.City,
                LocationName    = location.Result.Name,
                LocationState   = location.Result.State,
                LocationZip     = location.Result.Zip,
                TeamName        = _referenceRepository.GetTeamByTeamId(dto.TeamId).Result.Name,
                SecondGameTime  = _referenceRepository.GetTimeByTimeId(dto.Game2TimeId).Result.TimeHour,
                StartTime       = _referenceRepository.GetTimeByTimeId(dto.Game1TimeId - 1).Result.TimeHour,
            };

            if (dto.OrTimeId != 0)
            {
                details.OrGameTime = _referenceRepository.GetTimeByTimeId(dto.OrTimeId).Result.TimeHour;
            }

            return(details);
        }
Exemplo n.º 4
0
        public void ChampionshipEmailPreparation_When_executed_return_dto()
        {
            TournamentTeamDto dto = new TournamentTeamDto
            {
                TeamId      = 25,
                Game1TimeId = 7,
                Game2TimeId = 15,
                LocationId  = 50
            };

            Teams team = new Teams {
                Id = 25, Name = "Bulls"
            };
            CalendarTimes startTime = new CalendarTimes {
                Id = 6, TimeHour = "8:30 AM"
            };
            CalendarTimes firstTime = new CalendarTimes {
                Id = 7, TimeHour = "9:00 AM"
            };
            CalendarTimes secondTime = new CalendarTimes {
                Id = 15, TimeHour = "1:00 PM"
            };
            Locations location = new Locations
            {
                Id     = 50,
                Name   = "H. H. Poole Middle School",
                Street = "800 Eustace Road",
                City   = "Stafford",
                State  = "VA",
                Zip    = "22554"
            };

            ReferenceWorker.TournamentDetails expected = new ReferenceWorker.TournamentDetails
            {
                TeamName        = "Bulls",
                FirstGameTime   = "9:00 AM",
                SecondGameTime  = "1:00 PM",
                StartTime       = "8:30 AM",
                LocationName    = "H. H. Poole Middle School",
                LocationAddress = "800 Eustace Road",
                LocationCity    = "Stafford",
                LocationState   = "VA",
                LocationZip     = "22554"
            };

            _mockReferenceRepository.Setup(repository => repository.GetTeamByTeamId(25)).ReturnsAsync(team);
            _mockReferenceRepository.Setup(repository => repository.GetTimeByTimeId(6)).ReturnsAsync(startTime);
            _mockReferenceRepository.Setup(repository => repository.GetTimeByTimeId(7)).ReturnsAsync(firstTime);
            _mockReferenceRepository.Setup(repository => repository.GetTimeByTimeId(15)).ReturnsAsync(secondTime);
            _mockReferenceRepository.Setup(repository => repository.GetLocationByLocationId(50)).ReturnsAsync(location);

            var message =
                "<p>Hi Bulls Athletes, Athletes family, Coaches and Volunteers:<br /></p><p style=\"margin-left:30px;\"><strong>Everyone should be there at 8:30 AM.</strong><br /><br />The first game is at 9:00 AM.<br /><br />The second game is at 1:00 PM.<br /><br /><br />The competition will be at  H. H. Poole Middle School (800 Eustace Road, Stafford, VA 22554 )<br /><br /><br /><p style=\"margin-left:30px;\">You must return your uniform to your coach RIGHT AFTER SATURDAY’S COMPETITION. Remember bring a change of clothes. Failure to return your uniform may reflect on your athlete being selected for future Basketball Championships. There will also be a charge of $30 for jersey and $20 for shorts for all uniforms not returned at that time.<br /><br /><em>Remember no food or drinks are allowed in the Gymnasiums, only water.</em><br /><br /><br />Let me know if you have any questions.<br /><br /><br /></p><p>Van&nbsp;<br /><br /><br />L. A. Van Lowe&nbsp;<br /><br />Basketball Coordinator&nbsp;<br /><br /><br />P. O. 1073&nbsp;<br /><br />Woodbridge, VA 22195-1073&nbsp;<br /><br />Fax: (866) 558-8780&nbsp;<br /></p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";


            CoachEmailDto actual = _worker.ChampionshipEmailPreparation(dto);

            Assert.Equal(4, actual.SportId);
            Assert.Equal(dto.TeamId, actual.TeamId);
            Assert.Equal("*****@*****.**", actual.From);
            Assert.Equal("Basketball Tournament Information", actual.Subject);
            Assert.True(actual.Selected);
            Assert.Equal(message, actual.HtmlContent);
        }
Exemplo n.º 5
0
        public void ChampionshipTextPreparation_When_executed_return_dto()
        {
            TournamentTeamDto dto = new TournamentTeamDto
            {
                TeamId      = 25,
                Game1TimeId = 7,
                Game2TimeId = 15,
                LocationId  = 50
            };

            Teams team = new Teams {
                Id = 25, Name = "Bulls"
            };
            CalendarTimes startTime = new CalendarTimes {
                Id = 6, TimeHour = "8:30 AM"
            };
            CalendarTimes firstTime = new CalendarTimes {
                Id = 7, TimeHour = "9:00 AM"
            };
            CalendarTimes secondTime = new CalendarTimes {
                Id = 15, TimeHour = "1:00 PM"
            };
            Locations location = new Locations
            {
                Id     = 50,
                Name   = "H. H. Poole Middle School",
                Street = "800 Eustace Road",
                City   = "Stafford",
                State  = "VA",
                Zip    = "22554"
            };

            ReferenceWorker.TournamentDetails expected = new ReferenceWorker.TournamentDetails
            {
                TeamName        = "Bulls",
                FirstGameTime   = "9:00 AM",
                SecondGameTime  = "1:00 PM",
                StartTime       = "8:30 AM",
                LocationName    = "H. H. Poole Middle School",
                LocationAddress = "800 Eustace Road",
                LocationCity    = "Stafford",
                LocationState   = "VA",
                LocationZip     = "22554"
            };

            _mockReferenceRepository.Setup(repository => repository.GetTeamByTeamId(25)).ReturnsAsync(team);
            _mockReferenceRepository.Setup(repository => repository.GetTimeByTimeId(6)).ReturnsAsync(startTime);
            _mockReferenceRepository.Setup(repository => repository.GetTimeByTimeId(7)).ReturnsAsync(firstTime);
            _mockReferenceRepository.Setup(repository => repository.GetTimeByTimeId(15)).ReturnsAsync(secondTime);
            _mockReferenceRepository.Setup(repository => repository.GetLocationByLocationId(50)).ReturnsAsync(location);

            var message =
                "Bulls competition will be at H. H. Poole Middle School, everyone should arrive at 8:30 AM ";


            CoachTextDto actual = _worker.ChampionshipTextPreparation(dto);

            Assert.Equal(4, actual.SportId);
            Assert.Equal(dto.TeamId, actual.TeamId);
            Assert.True(actual.Selected);
            Assert.Equal(message, actual.Message);
        }
Exemplo n.º 6
0
        public void PrepareChampionshipDetails_When_executed_return_message()
        {
            TournamentTeamDto dto = new TournamentTeamDto
            {
                TeamId      = 25,
                Game1TimeId = 7,
                Game2TimeId = 15,
                LocationId  = 50
            };

            Teams team = new Teams {
                Id = 25, Name = "Bulls"
            };
            CalendarTimes startTime = new CalendarTimes {
                Id = 6, TimeHour = "8:30 AM"
            };
            CalendarTimes firstTime = new CalendarTimes {
                Id = 7, TimeHour = "9:00 AM"
            };
            CalendarTimes secondTime = new CalendarTimes {
                Id = 15, TimeHour = "1:00 PM"
            };
            Locations location = new Locations
            {
                Id     = 50,
                Name   = "H. H. Poole Middle School",
                Street = "800 Eustace Road",
                City   = "Stafford",
                State  = "VA",
                Zip    = "22554"
            };

            ReferenceWorker.TournamentDetails expected = new ReferenceWorker.TournamentDetails
            {
                TeamName        = "Bulls",
                FirstGameTime   = "9:00 AM",
                SecondGameTime  = "1:00 PM",
                StartTime       = "8:30 AM",
                LocationName    = "H. H. Poole Middle School",
                LocationAddress = "800 Eustace Road",
                LocationCity    = "Stafford",
                LocationState   = "VA",
                LocationZip     = "22554"
            };

            _mockReferenceRepository.Setup(repository => repository.GetTeamByTeamId(25)).ReturnsAsync(team);
            _mockReferenceRepository.Setup(repository => repository.GetTimeByTimeId(6)).ReturnsAsync(startTime);
            _mockReferenceRepository.Setup(repository => repository.GetTimeByTimeId(7)).ReturnsAsync(firstTime);
            _mockReferenceRepository.Setup(repository => repository.GetTimeByTimeId(15)).ReturnsAsync(secondTime);
            _mockReferenceRepository.Setup(repository => repository.GetLocationByLocationId(50)).ReturnsAsync(location);



            ReferenceWorker.TournamentDetails actual = _worker.PrepareChampionshipDetails(dto);
            Assert.Equal(expected.TeamName, actual.TeamName);
            Assert.Equal(expected.SecondGameTime, actual.SecondGameTime);
            Assert.Equal(expected.StartTime, actual.StartTime);
            Assert.Equal(expected.LocationZip, actual.LocationZip);
            Assert.Equal(expected.LocationAddress, actual.LocationAddress);
            Assert.Equal(expected.FirstGameTime, actual.FirstGameTime);
            Assert.Equal(expected.LocationCity, actual.LocationCity);
            Assert.Equal(expected.LocationName, actual.LocationName);
            Assert.Equal(expected.LocationState, actual.LocationState);
        }