public void Build_DefaultsToSecuredAnonymousConnectionNoAttachments() { // Arrange var fromAddress = new MailAddress("*****@*****.**"); var toAddress = new MailAddress("*****@*****.**"); var anotherAddress = new MailAddress("*****@*****.**"); // Act var builder = new EmailDestinationBuilder(fromAddress, new[] { toAddress, anotherAddress }, ServerName); string result = builder.Build(); // Assert var expected = string.Format( "Type=Mail;From={0};To={1},{2};UseAttachment={3};SmtpServer={4};UseSsl=true;Port=465;UseAuthentication=false;", fromAddress.Address, toAddress.Address, anotherAddress.Address, "false", ServerName); Assert.Equal(expected, result); }
public void BuildDefaultsToSecuredAnonymousConnectionWithAttachmentsTestUsingMailObject() { // Arrange var fromAddress = new MailAddress("*****@*****.**"); var toAddress = new MailAddress("*****@*****.**"); var anotherAddress = new MailAddress("*****@*****.**"); // Act var builder = new EmailDestinationBuilder(fromAddress, new[] { toAddress, anotherAddress }, ServerName); builder = builder.SendAttachments(); string result = builder.Build(); Mail mail = new Mail(result); // Assert Assert.Equal("*****@*****.**", mail.From); Assert.Equal("[email protected],[email protected]", mail.To); Assert.Equal(true, mail.UseAttachment); Assert.Equal(ServerName, mail.SmtpServer); Assert.Equal(true, mail.UseSsl); Assert.Equal(465, mail.Port); Assert.Equal(false, mail.UseAuthentication); }