public void ShouldReadPerson() { _personService = new PersonService(_factory); _person = new Person { FirstName = "First", LastName = "Last", BirthDate = DateTime.Now}; var newId = _personService.WritePerson(_person); var readPerson = _personService.GetPerson(newId); readPerson.FirstName.ShouldEqual(_person.FirstName); readPerson.LastName.ShouldEqual(_person.LastName); readPerson.PersonId.ShouldEqual(newId); }
public void ShouldReturnFooBarName() { var factory = new MockSqlHelperFactory(); var personService = new PersonService(factory); const string expectedFirst = "Foo"; const string expectedLast = "Bar"; var person = personService.GetPerson(Guid.NewGuid()); expectedFirst.ShouldEqual(person.FirstName); expectedLast.ShouldEqual(person.LastName); }
static void RunService() { var personService = new PersonService(new SqlHelperFactory()); var person = new Person { FirstName = "Joe", LastName = "Reynolds", BirthDate = DateTime.Parse("1/1/1900") }; var newId = personService.WritePerson(person); WriteLine(newId); var readPerson = personService.GetPerson(newId); WriteLine($"New Person ID: {readPerson.PersonId}"); WriteLine($"New Name: {readPerson.FirstName} {readPerson.LastName}"); WriteLine($"Birthday: {readPerson.BirthDate.ToShortDateString()}"); WriteLine("Did it work?"); ReadKey(); personService.CleanUp(); }