Exemple #1
0
    public void EmailOptionsBuilder_returns_non_null_parameters_if_nothing_configured()
    {
        var emailFactory = new TextEmailFactory();

        var email = emailFactory.Create(builder => { });

        Assert.NotNull(email.Subject);
        Assert.NotNull(email.Message);
        Assert.NotNull(email.Recipients);

        Assert.Empty(email.Subject);
        Assert.Empty(email.Message);
        Assert.Empty(email.Recipients);
    }
Exemple #2
0
    public void TextEmailFactory_makes_text_based_emails()
    {
        var emailFactory = new TextEmailFactory();

        var email = emailFactory.Create(builder =>
        {
            builder.SetSubject("my subject");

            builder.AddLine("line 1");
            builder.AddLine("line 2");
            builder.AddLines("line 3", "line 4");

            builder.AddRecipients("recipient1", "recipient2");
        });

        Assert.Equal("my subject", email.Subject);
        Assert.Equal("line 1\r\nline 2\r\nline 3\r\nline 4", email.Message);
        Assert.Equal(2, email.Recipients.ToList().Count);
        Assert.Contains("recipient1", email.Recipients);
        Assert.Contains("recipient2", email.Recipients);
    }