Exemple #1
0
        public void PhoneNumber_ShouldHaveMaxLength_10()
        {
            //---------------Set up test pack-------------------
            var sut=new Person();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            sut.ShouldHaveMaxLengthOf(10,o=>o.PhoneNumber);
            //---------------Test Result -----------------------
        }
 private static void MapEntityTo(Person person, Person entity)
 {
     entity.PersonId = person.PersonId;
     entity.Email = person.Email;
     entity.FirstName = person.FirstName;
     entity.Mimetype = person.Mimetype;
     entity.PhoneNumber = person.PhoneNumber;
     entity.Photo = person.Photo;
     entity.Surname = person.Surname;
 }
Exemple #3
0
        public void Email_ShouldHaveMaxLength_512()
        {
            //---------------Set up test pack-------------------
            var sut=new Person();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            sut.ShouldHaveMaxLengthOf(512,o=>o.Email);
            //---------------Test Result -----------------------
        }
 public int Save(Person person)
 {
     var entity = _lendingLibraryContext.People
         .FirstOrDefault(x => x.PersonId == person.PersonId);
     if (entity == null)
     {
         _lendingLibraryContext.People.Add(person);
     }
     else
     {
         MapEntityTo(person, entity);
     }
     _lendingLibraryContext.SaveChanges();
     return person.PersonId;
 }
Exemple #5
0
 private static void Create()
 {
     var person = new Person();
 }