Encamina.Enmarcha.Testing.Smtp 8.1.6-preview-07

This is a prerelease version of Encamina.Enmarcha.Testing.Smtp.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Encamina.Enmarcha.Testing.Smtp --version 8.1.6-preview-07                
NuGet\Install-Package Encamina.Enmarcha.Testing.Smtp -Version 8.1.6-preview-07                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Encamina.Enmarcha.Testing.Smtp" Version="8.1.6-preview-07" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Encamina.Enmarcha.Testing.Smtp --version 8.1.6-preview-07                
#r "nuget: Encamina.Enmarcha.Testing.Smtp, 8.1.6-preview-07"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Encamina.Enmarcha.Testing.Smtp as a Cake Addin
#addin nuget:?package=Encamina.Enmarcha.Testing.Smtp&version=8.1.6-preview-07&prerelease

// Install Encamina.Enmarcha.Testing.Smtp as a Cake Tool
#tool nuget:?package=Encamina.Enmarcha.Testing.Smtp&version=8.1.6-preview-07&prerelease                

Testing - SMPT

Nuget package

This project provides utilities for tests related to SMTP servers, allowing you to perform unit tests simulating all the aspects related to SMTP.

Setup

Nuget package

First, install NuGet. Then, install Encamina.Enmarcha.Testing.Smtp from the package manager console:

PM> Install-Package Encamina.Enmarcha.Testing.Smtp

.NET CLI:

Install .NET CLI. Next, install Encamina.Enmarcha.Testing.Smtp from the .NET CLI:

dotnet add package Encamina.Enmarcha.Testing.Smtp

How to use

At some initial point in your tests, for example, in the constructor of a test class, you can initialize a new instance of the SMTP server.

public class EmailServiceTests : FakerProviderFixturedBase, IDisposable
{
    private SmtpServer smtpServer;

    public EmailServiceTests(FakerProvider fakerFixture) : base(fakerFixture)
    {
        smtpServer = Configuration.Configure()
                                  .WithRandomPort()
                                  .Build();
    }

    public void Dispose()
    {
        smtpServer.Dispose();
        smtpServer = null;
    }
}

With this, you will achieve having the basic functionalities of an SMTP server locally to perform tests on an email service without external dependencies.

[Fact]
public void EmailService_SmtpClientOptions_ValidOptions_WithCustomName_Succeeds()
{
    // Arrange
    var smtpClientOptions = new SmtpClientOptions()
    {
        Host = smtpServer.Configuration.Domain,
        Port = smtpServer.Configuration.Port,
        Name = "dummy name",
        Password = "dummy password",
        User = "dummy user",
        // For test porposes, SSL should not be used. Otherwise, a `MailKit.Security.SslHandshakeException` might be thrown...
        UseSSL = false,
    };

    var emailService = new EmailService(smtpClientOptions);

    // ....

    // Act...
    emailService.SendAsync();

    // Assert
    // ...
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.2.0 73 10/22/2024
8.2.0-preview-01-m01 107 9/17/2024
8.1.9-preview-03 54 11/19/2024
8.1.9-preview-02 58 10/22/2024
8.1.9-preview-01 69 10/4/2024
8.1.8 94 9/23/2024
8.1.8-preview-07 100 9/12/2024
8.1.8-preview-06 93 9/11/2024
8.1.8-preview-05 79 9/10/2024
8.1.8-preview-04 104 8/16/2024
8.1.8-preview-03 97 8/13/2024
8.1.8-preview-02 94 8/13/2024
8.1.8-preview-01 97 8/12/2024
8.1.7 109 8/7/2024
8.1.7-preview-09 108 7/3/2024
8.1.7-preview-08 87 7/2/2024
8.1.7-preview-07 88 6/10/2024
8.1.7-preview-06 76 6/10/2024
8.1.7-preview-05 90 6/6/2024
8.1.7-preview-04 87 6/6/2024
8.1.7-preview-03 94 5/24/2024
8.1.7-preview-02 76 5/10/2024
8.1.7-preview-01 75 5/8/2024
8.1.6 127 5/7/2024
8.1.6-preview-08 56 5/2/2024
8.1.6-preview-07 97 4/29/2024
8.1.6-preview-06 103 4/26/2024
8.1.6-preview-05 106 4/24/2024
8.1.6-preview-04 80 4/22/2024
8.1.6-preview-03 93 4/22/2024
8.1.6-preview-02 94 4/17/2024
8.1.6-preview-01 82 4/15/2024
8.1.5 126 4/15/2024
8.1.5-preview-15 81 4/10/2024
8.1.5-preview-14 90 3/20/2024
8.1.5-preview-13 65 3/18/2024
8.1.5-preview-12 105 3/13/2024
8.1.5-preview-11 82 3/13/2024
8.1.5-preview-10 86 3/13/2024
8.1.5-preview-09 85 3/12/2024
8.1.5-preview-08 84 3/12/2024
8.1.5-preview-07 85 3/8/2024
8.1.5-preview-06 79 3/8/2024
8.1.5-preview-05 80 3/7/2024
8.1.5-preview-04 89 3/7/2024
8.1.5-preview-03 93 3/7/2024
8.1.5-preview-02 106 2/28/2024
8.1.5-preview-01 91 2/19/2024
8.1.4 120 2/15/2024
8.1.3 116 2/13/2024
8.1.3-preview-07 87 2/13/2024
8.1.3-preview-06 92 2/12/2024
8.1.3-preview-05 89 2/9/2024
8.1.3-preview-04 77 2/8/2024
8.1.3-preview-03 81 2/7/2024
8.1.3-preview-02 94 2/2/2024
8.1.3-preview-01 89 2/2/2024
8.1.2 115 2/1/2024
8.1.2-preview-9 102 1/22/2024
8.1.2-preview-8 92 1/19/2024
8.1.2-preview-7 90 1/19/2024
8.1.2-preview-6 83 1/19/2024
8.1.2-preview-5 90 1/19/2024
8.1.2-preview-4 96 1/19/2024
8.1.2-preview-3 94 1/18/2024
8.1.2-preview-2 84 1/18/2024
8.1.2-preview-16 90 1/31/2024
8.1.2-preview-15 90 1/31/2024
8.1.2-preview-14 73 1/25/2024
8.1.2-preview-13 85 1/25/2024
8.1.2-preview-12 86 1/23/2024
8.1.2-preview-11 84 1/23/2024
8.1.2-preview-10 83 1/22/2024
8.1.2-preview-1 86 1/18/2024
8.1.1 130 1/18/2024
8.1.0 105 1/18/2024
8.0.3 148 12/29/2023
8.0.1 163 12/14/2023
8.0.0 151 12/7/2023
6.0.4.3 123 12/29/2023
6.0.4.2 138 12/20/2023
6.0.4.1 109 12/19/2023
6.0.4 142 12/4/2023
6.0.3.20 143 11/27/2023
6.0.3.19 139 11/22/2023