public void FullTestModification() { MockRepository mock = new MockRepository(); IQuoteRepository mockedRepos = mock.CreateMock <IQuoteRepository>(); Quote q = new Quote(); Distributor expDistributor = new Distributor(); expDistributor.AddContact("Sebastian", "Real", "*****@*****.**"); expDistributor.AddContact("Emiliano", "Galizio", "*****@*****.**"); expDistributor.AddContact("Santiago", "Lanus", "*****@*****.**"); q.Distributor = expDistributor; foreach (Contact contact in expDistributor.Contacts) { q.AddNotification(contact, string.Empty, string.Empty); } Expect.Call(mockedRepos.GetById(12)).Return(q); mock.ReplayAll(); QuoteController qc = new QuoteController(mockedRepos); Quote test = qc.GetById(12); test.AddNotification(null, "Alejandro Bezares", "*****@*****.**"); Assert.AreEqual(4, test.QuoteNotifications.Count); }
public void AddContactToDistributor() { Distributor d = new Distributor(); d.AddContact("Sebastian", "Real", "*****@*****.**"); d.AddContact("Emiliano", "Galizio", "*****@*****.**"); d.AddContact("Sebastian", "Real", "*****@*****.**"); }
public Contact AddContact(int distributorId, string name, string lastName, string email) { Distributor d = GetById(distributorId); Contact c = null; if (d != null) { c = d.AddContact(name, lastName, email); repository.Save(d); } return(c); }