fm.Extensions.Testing.DependencyInjection.MSTest 6.0.0

Provides a MSTest base class for tests based on Microsoft.Extensions.DependencyInjection. Use common Startup.cs patterns like ConfigureServices(...) and Configure(...) to setup your tests.
Includes TestContext properties in configuration and enables TestContext logging.

Commonly used types:
ServiceTestsBase

[TestClass]
public sealed class ExampleTests : ServiceTestsBase
{
   protected override void ConfigureConfiguration([NotNull] IConfigurationBuilder configuration)
   {
       base.ConfigureConfiguration(configuration);

       // Add additional configuration here
       configuration.AddInMemoryCollection(new[]
           {
               new KeyValuePair<string, string>("ConfigKey", "ConfigValue"),
           });
   }

   protected override void ConfigureLogging([NotNull] ILoggingBuilder builder)
   {
       base.ConfigureLogging(builder);

       // Add additional loggers or configuration
       builder.AddFilter(logLevel => true);
   }

   protected override void ConfigureServices([NotNull] IServiceCollection services)
   {
       base.ConfigureServices(services);

       // Configure your services here
       // services.AddSingleton<IMyService, MyService>();
   }

   [TestMethod]
   public void ExampleTest()
   {
       // Use your DI container as you would during runtime
       // IMyService service = this.GetRequiredService<IMyService>();
   }
}

Install-Package fm.Extensions.Testing.DependencyInjection.MSTest -Version 6.0.0
dotnet add package fm.Extensions.Testing.DependencyInjection.MSTest --version 6.0.0
<PackageReference Include="fm.Extensions.Testing.DependencyInjection.MSTest" Version="6.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add fm.Extensions.Testing.DependencyInjection.MSTest --version 6.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: fm.Extensions.Testing.DependencyInjection.MSTest, 6.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install fm.Extensions.Testing.DependencyInjection.MSTest as a Cake Addin
#addin nuget:?package=fm.Extensions.Testing.DependencyInjection.MSTest&version=6.0.0

// Install fm.Extensions.Testing.DependencyInjection.MSTest as a Cake Tool
#tool nuget:?package=fm.Extensions.Testing.DependencyInjection.MSTest&version=6.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

BREAKING CHANGE: Removed dependency on fm.Extensions.Testing.DependencyInjection and implemented those features directly.
ServiceTests -> ServiceTestsBase
Everything is now stored inside the TestContext for the best test isolation possible.
Removed redundant IDisposable interface
Do async test cleanup (if possible)
Added netstandard2.1 target

NuGet packages (1)

Showing the top 1 NuGet packages that depend on fm.Extensions.Testing.DependencyInjection.MSTest:

Package Downloads
fm.Extensions.Logging.Testing.MSTest
Logs and reports log messages that have not been handled during UnitTests.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
6.0.0 53 4/2/2021
6.0.0-preview.3 22 4/2/2021
6.0.0-preview.2 22 4/2/2021
6.0.0-preview.1 55 4/1/2021
5.0.0 371 11/15/2020
4.2.0 432 1/4/2020
4.1.0 262 10/23/2019
4.0.0 403 9/4/2019
4.0.0-preview.2 184 2/26/2019
4.0.0-preview.1 169 2/26/2019
3.0.0 5,758 10/12/2017
2.0.0 458 10/9/2017
1.0.0 629 2/27/2017