コード例 #1
0
        public void CreateMailer_NullArguments_ThrowsException()
        {
            // Arrange
            var mockApiGateway = new Mock<IReachMailApiGateway>();
            var mockMailerService = new MailerService(mockApiGateway.Object);

            // Act & Assert
            mockMailerService.CreateMailer("", "fromEmail", "fromName", "replyToEmail", "subject", "text");
        }
コード例 #2
0
        public void CreateMailer_ValidArgs_ReturnsGuid()
        {
            // Arrange
            var knownGuid = Guid.NewGuid();
            var mockApiGateway = new Mock<IReachMailApiGateway>();
            mockApiGateway.Setup(m => m.CreateMailer(It.IsAny<String>(), It.IsAny<String>(), It.IsAny<String>(), It.IsAny<String>(), It.IsAny<String>(), It.IsAny<String>()))
                .Returns(knownGuid);

            var mailerService = new MailerService(mockApiGateway.Object);

            // Act
            var list = mailerService.CreateMailer("name", "fromEmail", "fromName", "replyToEmail", "subject", "text");

            // Assert
            Assert.AreEqual(knownGuid, list.Id);
        }