Exemplo n.º 1
0
        public void CustomerFieldsShouldWorkCorreclty()
        {
            var cust = Contact.CreateNewContact();
            var repos = new ContactRepository(Constants.CONTACT_DATA_FILE);
            var target = new ContactViewModel(cust, repos);

            target.FirstName = Resources.Contact_Error_MissingFirstName;
            Assert.AreEqual(target.FirstName, "First name is missing");

            target.LastName = Resources.Contact_Error_MissingLastName;
            Assert.AreEqual(target.LastName, "Last name is missing");

            target.PhoneNumber = Resources.Contact_Error_MissingPhoneNumber;
            Assert.AreEqual(target.PhoneNumber, "Phone number is missing");

            target.Email = Resources.Contact_Error_InvalidEmail;
            Assert.AreEqual(target.Email, "E-mail address is invalid");

            target.Email = Resources.Contact_Error_MissingEmail;
            Assert.AreEqual(target.Email, "E-mail address is missing");
        }
Exemplo n.º 2
0
 void OnContactAddedToRepository(object sender, ContactAddedEventArgs e)
 {
     var viewModel = new ContactViewModel(e.NewContact, _contactRepository);
     this.AllContacts.Add(viewModel);
 }
Exemplo n.º 3
0
 void CreateNewContact()
 {
     var newContact = Contact.CreateNewContact();
     var workspace = new ContactViewModel(newContact, _contactRepository);
     this.Workspaces.Add(workspace);
     this.SetActiveWorkspace(workspace);
 }