Skip to content

Commit

Permalink
fix: test must have assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
TomaszKandula committed Apr 23, 2024
1 parent eced07d commit 3545669
Showing 1 changed file with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using EmailSender.Services.SmtpService;
using EmailSender.Services.SenderService;
using EmailSender.Services.SenderService.Models;
using MailKit;

namespace EmailSender.Tests.UnitTests.Services;

Expand Down Expand Up @@ -487,8 +488,34 @@ public async Task GivenValidEmailDataAndServerData_WhenInvokeSend_ShouldSucceed(
};

// Act
// Assert
await service.Send(configuration, CancellationToken.None);

// Assert
mockedSmtpClient.Verify(x => x.ConnectAsync(
It.IsAny<string>(),
It.IsAny<int>(),
It.IsAny<SecureSocketOptions>(),
It.IsAny<CancellationToken>()),
Times.Once);

mockedSmtpClient.Verify(x => x.AuthenticateAsync(
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<CancellationToken>()),
Times.Once);

mockedSmtpClient.Verify(x => x.SendAsync(
It.IsAny<MimeMessage>(),
It.IsAny<CancellationToken>(),
It.IsAny<ITransferProgress>()
),
Times.Once);

mockedSmtpClient.Verify(x => x.DisconnectAsync(
It.IsAny<bool>(),
It.IsAny<CancellationToken>()
),
Times.Once);
}

[Fact]
Expand Down

0 comments on commit 3545669

Please sign in to comment.