public void Insert1() { InvoiceProxy proxy = new InvoiceProxy(); InvoiceDto dto1 = this.GetSale1(); EmailMessageDto emailMessage = new EmailMessageDto(); emailMessage.From = ConfigurationSettings.AppSettings["NUnitTests.Email.From"]; emailMessage.To = ConfigurationSettings.AppSettings["NUnitTests.Email.To"]; emailMessage.Subject = "Invoice - Sent using NetAccounts OLA REST API (TestInsertAndEmail)."; emailMessage.Body = "Insert Invoice then email."; proxy.InsertAndEmail(dto1, emailMessage); Assert.IsTrue(dto1.Uid > 0, "Uid must be > 0 after save."); // // Ensure IsSent is updated. // dto1 = (InvoiceDto)proxy.GetByUid(dto1.Uid); Assert.IsTrue(dto1.IsSent, "Invoice should have been sent."); }
public void InsertAndEmailUsingShippingSlipTemplate() { InvoiceProxy proxy = new InvoiceProxy(); InvoiceDto dto1 = this.GetServiceSale(); EmailMessageDto emailMessage = new EmailMessageDto(); emailMessage.From = ConfigurationSettings.AppSettings["NUnitTests.Email.From"]; emailMessage.To = ConfigurationSettings.AppSettings["NUnitTests.Email.To"]; emailMessage.Subject = "Insert And Email: Shipping slip Template"; emailMessage.Body = "Insert Invoice then email."; proxy.InsertAndEmail(dto1, this.ShippingTemplateUid, emailMessage); Assert.IsTrue(dto1.Uid > 0, "Uid must be > 0 after save."); // // Ensure IsSent is updated. // dto1 = (InvoiceDto)proxy.GetByUid(dto1.Uid); Assert.IsTrue(dto1.IsSent, "Invoice should have been sent."); }
public void InsertAndEmailUsingInvalidTemplate() { InvoiceProxy proxy = new InvoiceProxy(); InvoiceDto dto1 = this.GetServiceSale(); EmailMessageDto emailMessage = new EmailMessageDto(); emailMessage.From = ConfigurationSettings.AppSettings["NUnitTests.Email.From"]; emailMessage.To = ConfigurationSettings.AppSettings["NUnitTests.Email.To"]; emailMessage.Subject = "Insert And Email: Template Not Specified"; emailMessage.Body = "Insert Invoice then email."; try { proxy.InsertAndEmail(dto1, 99999, emailMessage); throw new Exception("Expected exception not thrown."); } catch (RestException rex) { Assert.AreEqual("Unable to find the requested template.", rex.Message, "Incorrect error message."); } }