public void TestQueueWithEmptyList( ) { Rhino.Mocks.MockRepository oMocks = new Rhino.Mocks.MockRepository( ); Utility.IXmlFilePersister oXmlFilePersister = oMocks.StrictMock <Utility.IXmlFilePersister> ( ); using (oMocks.Record( )) { Rhino.Mocks.Expect .Call(oXmlFilePersister.Load("")) .IgnoreArguments( ) .Return(null); Rhino.Mocks.Expect .Call(() => oXmlFilePersister.Save("", null)) .IgnoreArguments( ); } using (oMocks.Playback( )) { Service.Waitlist svc = new Service.Waitlist(oXmlFilePersister); string sName = Guid.NewGuid( ).ToString( ); string sPhone = Guid.NewGuid( ).ToString( ); Data.Person dPerson = svc.Queue(sName, sPhone); Assert.IsNotNull(dPerson); Assert.AreEqual(sName, dPerson.Name); Assert.AreEqual(sPhone, dPerson.Phone); Assert.AreNotEqual(Guid.Empty, dPerson.Id); } }
public static Person CreateNewPerson( string titulPred, string jmeno, string prijmeni, string titulPo, string narozeni, StatusOsobyEnum status ) { Person p = new Data.Person(); p.TitulPred = NormalizeTitul(titulPred, true); p.TitulPo = NormalizeTitul(titulPo, false); p.Jmeno = NormalizeJmeno(jmeno); p.Prijmeni = NormalizePrijmeni(prijmeni); p.PersonStatus = (int)status; p.Narozeni = null; DateTime o; if (DateTime.TryParseExact(narozeni, "d.M.yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out o)) //28.3.1955 { p.Narozeni = o; } else if (DateTime.TryParseExact(narozeni, "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out o)) //28.03.1955 { p.Narozeni = o; } else if (DateTime.TryParseExact(narozeni, "dd.MM.yy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out o)) //28.03.55 { p.Narozeni = o; } return(p); }
public async Task <Data.Person> GetByPersonIdentification(string IdType, string IdNumber) { Data.Person person = await _context.Person.SingleOrDefaultAsync(x => x.IdentificationNumber == IdNumber && x.IdentificationNumberType == IdType && !x.Deleted); return(person); }
public async Task <ServiceResult> ProcessAsync() { ServiceResult serviceResult = new ServiceResult(); Dictionary <string, List <string> > validationResults = null; try { validationResults = await ServiceValidation(); if (validationResults != null && validationResults.Count > 0) { throw new ValidationException("There has been a validation error"); } //Pulls out the person from the repository Data.Person person = await _personRepository.GetPersonAsync(_request.PersonID.Value); //builds our response and status code output serviceResult.Response = new GetPersonResponse() { Successful = true, Person = person }; serviceResult.StatusCode = HttpStatusCode.OK; } catch (ValidationException) { serviceResult.Response = new ValidationErrorResponse() { Successful = false, ValidationErrors = validationResults }; serviceResult.StatusCode = HttpStatusCode.BadRequest; } catch (Exception) { serviceResult.Response = new ErrorResponse() { Successful = false, Message = "There has been an error." }; serviceResult.StatusCode = HttpStatusCode.InternalServerError; } finally { validationResults = null; } return(serviceResult); }
public static Person Map(this Data.Person p) { Person person = new Person { ID = p.ID, Email = p.Email, FirstName = p.FirstName, LastName = p.LastName, Title = p.Title, Bio = p.Bio, Website = p.Website, Blog = p.Blog, Twitter = p.Twitter, ImageUrl = p.ImageUrl }; return(person); }
public static Speaker AsSpeaker(this Data.Person p) { Speaker speaker = new Speaker() { ID = p.ID, Email = p.Email, FirstName = p.FirstName, LastName = p.LastName, Title = p.Title, Bio = p.Bio, Website = p.Website, Blog = p.Blog, Twitter = p.Twitter, ImageUrl = p.ImageUrl }; foreach (var session in p.Sessions) { speaker.Sessions.Add(session.Map()); } return(speaker); }
public static Data.Person MapDtoToEntity(DTOs.Person source) { var destination = new Data.Person { Id = source.Id, Address = source.Address, Address2 = source.Address2, City = source.City, Dob = source.Dob, FName = source.FName, LName = source.LName, Postcode = source.Postcode, Suburb = source.Suburb }; //if (!source.PolicyHolders.Any()) return destination; //foreach (var policyHolder in source.PolicyHolders) //{ // destination.PolicyHolders.Add(PolicyHolderMapping.MapDtoToEntity(policyHolder)); //} return(destination); }
private void Action(Data.Person person) { var b = 2; }
public static Data.Person Map(this Person p) { var person = new Data.Person() { ID = p.ID, Email = p.Email, FirstName = p.FirstName, LastName = p.LastName, Title = p.Title, Bio = p.Bio, Website = p.Website, Blog = p.Blog, Twitter = p.Twitter, ImageUrl = p.ImageUrl }; return person; }
public async Task TestProcessTransactionLog_TransactionLogHasNewParticipantAndNewDependent() { var expectedParticipantSevisId = "N0000158857"; var expectedDependentSevisId = "N0000158274"; var transactionXml = ECA.Business.Test.Properties.Resources.TransactionLogWithNewParticipantAndNewDependent; var batchXml = ECA.Business.Test.Properties.Resources.NewParticipantWithNewDependentBatchXml; var user = new User(1); var yesterday = DateTimeOffset.UtcNow.AddDays(-1.0); var otherUser = new User(user.Id + 1); var batchId = "----kynEn47azQ"; Participant participant = null; ParticipantPerson participantPerson = null; PersonDependent personDependent = null; Data.Person person = null; SevisBatchProcessing batch = null; ExchangeVisitorHistory history = null; var personId = 63280; var participantId = 59079; context.SetupActions.Add(() => { batch = new SevisBatchProcessing { BatchId = batchId, Id = 1, SendString = batchXml }; participant = new Participant { ParticipantId = participantId }; participantPerson = new ParticipantPerson { ParticipantId = participant.ParticipantId, Participant = participant, SevisBatchResult = "sevis batch result", }; participantPerson.History.CreatedBy = otherUser.Id; participantPerson.History.CreatedOn = yesterday; participantPerson.History.RevisedBy = otherUser.Id; participantPerson.History.RevisedOn = yesterday; participant.ParticipantPerson = participantPerson; person = new Data.Person { PersonId = personId }; participant.Person = person; participant.PersonId = person.PersonId; personDependent = new PersonDependent { DependentId = 6, Person = person, PersonId = person.PersonId }; person.Family.Add(personDependent); history = new ExchangeVisitorHistory { ParticipantId = participantId }; context.ExchangeVisitorHistories.Add(history); context.PersonDependents.Add(personDependent); context.Participants.Add(participant); context.ParticipantPersons.Add(participantPerson); context.People.Add(person); context.SevisBatchProcessings.Add(batch); }); Action tester = () => { Assert.AreEqual(expectedParticipantSevisId, participantPerson.SevisId); Assert.AreEqual(expectedDependentSevisId, personDependent.SevisId); }; context.Revert(); service.ProcessTransactionLog(user, batchId, transactionXml, fileProvider.Object); tester(); context.Revert(); await service.ProcessTransactionLogAsync(user, batchId, transactionXml, fileProvider.Object); tester(); }
public override bool Matches(Data.Person person) { return(person.LastName + ", " + person.HisName == Name); }