fm.Extensions.Testing.DependencyInjection 4.2.1

Provides a base class for tests based on Microsoft.Extensions.DependencyInjection. Use common Startup.cs patterns like ConfigureConfiguration(...), ConfigureServices(...) and Configure(...) to setup your tests.

Commonly used types:
ServiceTestsBase

Example:
[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 -Version 4.2.1
dotnet add package fm.Extensions.Testing.DependencyInjection --version 4.2.1
<PackageReference Include="fm.Extensions.Testing.DependencyInjection" Version="4.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add fm.Extensions.Testing.DependencyInjection --version 4.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

Upgrade to Core packages 2.2

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
4.2.1 143 2/26/2019
4.2.0 117 2/26/2019
4.0.0 3,592 10/11/2017
3.0.0 204 10/9/2017
2.0.0 427 2/27/2017
1.0.0 459 6/29/2016