public RazorEmailResult TypedBroken(EmailModel model) { From = "*****@*****.**"; To.Add(model.EmailAddress); Subject = string.Format("Thanks {0} for your purchases", model.BirthName); return Email("TypedBroken", model); }
public static void Typed() { var model = new EmailModel { Title = "Mr", BirthName = "Phil", FamilyName = "Jones", EmailAddress = "*****@*****.**", PurchasedItems = new List<EmailModel.Item> { new EmailModel.Item { Quantity = 2, Product = "Foo", Price = (decimal) 12.99 }, new EmailModel.Item { Quantity = 10, Product = "Bar", Price = (decimal) 24.99 } } }; new EmailService().Typed(model).Deliver(); }
public void ShowOffCompilingRazorTemplatesThatFail() { var expected = new EmailModel { Title = "Mr", BirthName = "Bob", FamilyName = "Smith", EmailAddress = "*****@*****.**", PurchasedItems = new List<EmailModel.Item> { new EmailModel.Item { Quantity = 2, Product = "Foo", Price = (decimal) 12.99 }, new EmailModel.Item { Quantity = 10, Product = "Bar", Price = (decimal) 24.99 } } }; var actual = _service.TypedBroken(expected); actual.Compile(expected); Assert.AreEqual("Thanks Bob for your purchases", actual.Mail.Subject); }