public void AContactWithAllFieldsFilledInIsValid()
        {
            // Given a fully filled in and valid contact
            var contact = new Contact(Name, Email, Mobile);

            // Then the validator states the contact is valid
            Assert.True(subject.IsValid(contact));
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var user = new User {
                Id = 1, Name = "Name"
            };

            var phone = new Contact {
                Type = ContactType.Phone, Id = 1, PhoneCode = "123", Value = "123124"
            };
            var email = new Contact {
                Type = ContactType.Email, Id = 2, Value = "*****@*****.**"
            };

            var validator = new ContactValidator();

            var userRepository = GetRepository <User>();

            userRepository.Add(user);

            var contactRepository = GetRepository <Contact>();

            if (validator.IsValid(email))
            {
                contactRepository.Add(phone);
            }

            if (validator.IsValid(phone))
            {
                contactRepository.Add(email);
            }

            Console.WriteLine(contactRepository.GetById(1));

            Console.WriteLine(contactRepository.GetById(2));
            Console.ReadLine();
        }