Beispiel #1
0
 public void We_can_set_a_persons_name_and_email()
 {
     var person = new Person();
      person.Name = "Mark";
      person.Email = "*****@*****.**";
      person.Name.ShouldBe("Mark");
      person.Email.ShouldBe("*****@*****.**");
 }
Beispiel #2
0
        public void We_can_persist_a_person()
        {
            var person = new Person
                         {
                            Name = "Mark W",
                            Email = "*****@*****.**"
                         };

             _personRepository.Save(person);
             Person person2 = _personRepository.GetByName(person.Name);
             person2.Name.ShouldBe("Mark W");
             person2.Email.ShouldBe("*****@*****.**");
        }
Beispiel #3
0
        public void SaveNewPerson(string name, string email)
        {
            if (!email.Contains("@"))
             {
            _view.NotifyOfInvalidation("email was not valid");
            return;
             }

             if (name == null || name.Length == 0)
             {
            _view.NotifyOfInvalidation("name was not valid");
            return;
             }

             var newPerson = new Person
                            {
                               Name = name,
                               Email = email
                            };

             _personRepository.Save(newPerson);
             _view.NotifyOfSuccess();
        }
Beispiel #4
0
        public void SaveNewPerson(string name, string email)
        {
            if (!email.Contains("@"))
             {
            ErrorMessage = "email was not valid";
            return;
             }

             if (name == null || name.Length == 0)
             {
            ErrorMessage = "name was not valid";
            return;
             }

             var newPerson = new Person
             {
            Name = name,
            Email = email
             };

             _personRepo.Save(newPerson);
             ErrorMessage = "Person was saved!";
        }
Beispiel #5
0
 public void We_can_create_a_new_Person_Domain_obj()
 {
     var person = new Person();
      person.ShouldNotBe(null);
 }
Beispiel #6
0
 public void Save(Person person)
 {
     _persons.Add(person);
 }