public void ShouldThrowIfEmptyBody()
        {
            // Arrange
            IEmailRequestBuilder builder = new EmailRequestBuilder()
                .AddTo("*****@*****.**")
                .WithSubject("Hello");

            // Act & Assert
            Should.Throw<DreamFactoryException>(() => builder.Build());
        }
        public void ShouldThrowIfNoRecipients()
        {
            // Arrange
            IEmailRequestBuilder builder = new EmailRequestBuilder()
                .WithSubject("Hello")
                .WithBody("Hello, World!");

            // Act & Assert
            Should.Throw<DreamFactoryException>(() => builder.Build());
        }
        public void ShouldThrowIfNoTitle()
        {
            // Arrange
            IEmailRequestBuilder builder = new EmailRequestBuilder()
                .AddTo("*****@*****.**")
                .WithBody("Hello, World!");

            // Act & Assert
            Should.Throw<DreamFactoryException>(() => builder.Build());
        }
Пример #4
0
        public void ShouldBuildEmailRequest()
        {
            // Arrange
            IEmailRequestBuilder builder = new EmailRequestBuilder()
                .AddTo("*****@*****.**")
                .WithSubject("Hello")
                .WithBody("Hello, World!");

            // Act
            EmailRequest request = builder.Build();

            // Assert
            request.subject.ShouldBe("Hello");
            request.body_text.ShouldBe("Hello, World!");
            request.to.Single().email.ShouldBe("*****@*****.**");
        }
        public void ShouldBuildEmailRequest()
        {
            // Arrange
            IEmailRequestBuilder builder = new EmailRequestBuilder()
                .AddTo("*****@*****.**")
                .WithSubject("Hello")
                .WithBody("Hello, World!");

            // Act
            EmailRequest request = builder.Build();

            // Assert
            request.Subject.ShouldBe("Hello");
            request.BodyText.ShouldBe("Hello, World!");
            request.To.Single().Email.ShouldBe("*****@*****.**");

            Should.Throw<ArgumentNullException>(() => builder.AddTo(null));
            Should.Throw<ArgumentNullException>(() => builder.WithSubject(null));
            Should.Throw<ArgumentNullException>(() => builder.WithBody(null));
        }