public void FullTestCreation() { MockRepository mock = new MockRepository(); IDistributorRepository mockedRepos = mock.CreateMock <IDistributorRepository>(); Distributor expDistributor = new Distributor(); expDistributor.AddContact("Sebastian", "Real", "*****@*****.**"); expDistributor.AddContact("Emiliano", "Galizio", "*****@*****.**"); expDistributor.AddContact("Santiago", "Lanus", "*****@*****.**"); Expect.Call(mockedRepos.GetById(123321)).Return(expDistributor); mock.ReplayAll(); DistributorController dc = new DistributorController(mockedRepos); Distributor distributor = dc.GetById(123321); Quote q = new Quote(); foreach (Contact contact in distributor.Contacts) { q.AddNotification(contact, string.Empty, string.Empty); } q.AddNotification(null, "Alejandro Bezares", "*****@*****.**"); Assert.AreEqual(4, q.QuoteNotifications.Count); }
public void AddNotificationWhitException() { Quote q = new Quote(); q.AddNotification(null, "Sebastian Real", "*****@*****.**"); Contact c = new Contact("Sebastian", "Real", "*****@*****.**"); q.AddNotification(c, string.Empty, string.Empty); }
public void AddNotification() { Quote q = new Quote(); q.AddNotification(null, "Sebastian Real", "*****@*****.**"); Contact c = new Contact("Emiliano", "Galizio", "*****@*****.**"); q.AddNotification(c, string.Empty, string.Empty); c = new Contact("Santiago", "Lanus", "*****@*****.**"); q.AddNotification(c, string.Empty, string.Empty); Assert.AreEqual(3, q.QuoteNotifications.Count); }
public void FullTestModification() { Quote test = ControllerManager.Quote.GetById(65); test.AddNotification(null, "Sebastian Real", "*****@*****.**"); Assert.AreEqual(6, test.QuoteNotifications.Count); }
private void AddContactNotifications(Quote q, List <Contact> contacts, List <int> contactids) { q.QuoteNotifications.Clear(); foreach (int contactid in contactids) { Contact c = contacts.Find(delegate(Contact record) { if (record.ID == contactid) { return(true); } return(false); }); if (c != null) { try { q.AddNotification(c, string.Empty, string.Empty); } catch (Exception ex) { if (ex is QuoteNotificationAlreadyExistException) { continue; } throw ex; } } } }
public void FullTestCreation() { ControllerManager.Quote.BeginTransactions(); Distributor distributor = ControllerManager.Distributor.GetById(2); Quote q = new Quote(); q.Distributor = ControllerManager.Distributor.GetById(141); q.Description = "NUnit Testing #2"; q.Vigency = ControllerManager.Lookup.GetById(12); q.IntroText = ControllerManager.Lookup.GetById(17); q.Condition = ControllerManager.Lookup.GetById(16); foreach (Contact contact in distributor.Contacts) { q.AddNotification(contact, string.Empty, string.Empty); } q.AddNotification(null, "Alejandro Bezares", "*****@*****.**"); ControllerManager.Quote.Save(q); ControllerManager.Quote.CommitChange(); Assert.AreEqual(5, q.QuoteNotifications.Count); }
private void AddNotifications(Quote q, string name, string email) { try { q.AddNotification(null, name, email); } catch (Exception ex) { if (ex is QuoteNotificationAlreadyExistException) { return; } throw ex; } }
public void AddNotification() { ControllerManager.Quote.BeginTransactions(); Quote q = new Quote(); q.Distributor = ControllerManager.Distributor.GetById(141); q.Description = "NUnit Testing #1"; q.Vigency = ControllerManager.Lookup.GetById(12); q.IntroText = ControllerManager.Lookup.GetById(17); q.Condition = ControllerManager.Lookup.GetById(16); q.AddNotification(null, "Sebastian Real", "*****@*****.**"); ControllerManager.Quote.Save(q); ControllerManager.Quote.CommitChange(); Assert.AreEqual(1, q.QuoteNotifications.Count); }