Ejemplo n.º 1
0
        public void PerpareRegistrantDataForClient_With_Athlete_When_executed_return_dto(int sportId, int expected)

        {
            RegisteredAthlete athlete = new RegisteredAthlete {
                AthletesId = 219, Id = 67
            };
            Registrant registrant = new Registrant
            {
                FirstName   = "Clark",
                LastName    = "Kent",
                NickName    = "Superman",
                Id          = 1,
                ProgramId   = 10,
                SportId     = 4,
                Size        = "small",
                SportTypeId = 2,
                IsVolunteer = true,
                Selected    = true,
                TeamId      = 8,
            };

            registrant.RegisteredAthlete.Add(athlete);
            RegistrantDto actual = _worker.PrepareRegistrantDataForClient(registrant);

            Assert.Equal(athlete.Id, actual.RegisteredAthletesId);
            Assert.Equal(athlete.AthletesId, actual.AthletesId);
            //Assert.Equal(_athlete1.BirthDate, actual.BirthDate);
            Assert.Equal(_athlete1.MedicalExpirationDate, actual.MedicalExpirationDate);
            Assert.Equal(_athlete1.MF, actual.Gender);
        }
Ejemplo n.º 2
0
        public void PrepareRegistrantDataForClient_With_1_Phone_When_executed_return_dto(int sportId, int expected)

        {
            RegisteredAthlete athlete = new RegisteredAthlete {
                AthletesId = 219, Id = 67
            };
            RegistrantPhone phone1 = new RegistrantPhone {
                Phone = "703-555-1212", CanText = true, PhoneType = "cell", Id = 15
            };
            Registrant registrant = new Registrant
            {
                FirstName   = "Clark",
                LastName    = "Kent",
                NickName    = "Superman",
                Id          = 1,
                ProgramId   = 10,
                SportId     = 4,
                Size        = "small",
                SportTypeId = 2,
                IsVolunteer = true,
                Selected    = true,
                TeamId      = 8,
            };

            registrant.RegisteredAthlete.Add(athlete);
            registrant.RegistrantPhone.Add(phone1);
            RegistrantDto actual = _worker.PrepareRegistrantDataForClient(registrant);

            Assert.Equal(phone1.Id, actual.RegistrantPhone1Id);
            Assert.Equal(phone1.CanText, actual.CanText1);
            Assert.Equal(phone1.Phone, actual.Phone1);
            Assert.Equal(phone1.PhoneType, actual.PhoneType1);
        }
Ejemplo n.º 3
0
        public void PrepareRegistrantDataForClient_With_1_Email_When_executed_return_dto(int sportId, int expected)

        {
            RegisteredAthlete athlete = new RegisteredAthlete {
                AthletesId = 219, Id = 67
            };
            RegistrantEmail email1 = new RegistrantEmail()
            {
                Email = "*****@*****.**", Id = 15
            };
            Registrant registrant = new Registrant
            {
                FirstName   = "Clark",
                LastName    = "Kent",
                NickName    = "Superman",
                Id          = 1,
                ProgramId   = 10,
                SportId     = 4,
                Size        = "small",
                SportTypeId = 2,
                IsVolunteer = true,
                Selected    = true,
                TeamId      = 8,
            };

            registrant.RegisteredAthlete.Add(athlete);
            registrant.RegistrantEmail.Add(email1);
            RegistrantDto actual = _worker.PrepareRegistrantDataForClient(registrant);

            Assert.Equal(email1.Id, actual.RegistrantEmail1Id);
            Assert.Equal(email1.Email, actual.Email1);
        }
Ejemplo n.º 4
0
        public async Task <Registrant> AddRegisteredAthlete(int registrantId, int athleteId)
        {
            var athlete = new RegisteredAthlete()
            {
                AthletesId = athleteId, RegistrantId = registrantId
            };
            var registrant = await _context.Registrant
                             .Where(r => r.Id == registrantId).FirstOrDefaultAsync();

            registrant?.RegisteredAthlete.Add(athlete);
            _context.SaveChanges();

            return(registrant);
        }