NK.MongoDB.Embedded
0.2.68
dotnet add package NK.MongoDB.Embedded --version 0.2.68
NuGet\Install-Package NK.MongoDB.Embedded -Version 0.2.68
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="NK.MongoDB.Embedded" Version="0.2.68" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NK.MongoDB.Embedded --version 0.2.68
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NK.MongoDB.Embedded, 0.2.68"
#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 NK.MongoDB.Embedded as a Cake Addin
#addin nuget:?package=NK.MongoDB.Embedded&version=0.2.68
// Install NK.MongoDB.Embedded as a Cake Tool
#tool nuget:?package=NK.MongoDB.Embedded&version=0.2.68
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
This project makes it possible to run unit test on a real MongoDB Instance without mocking the persistence layer.
General
The MongoServerBuilder
is the base for the Mongo Server-Version to be used.
Based on the OS-Configuration and the MongoDB Version, the corresponding download
link generated.
Supported OS
Windows
macOS
Linux
Supported Linux Distributions
Ubuntu 16.04
Ubunut 18.04
Supported MongoDB-Versions
4.2.0
4.2.1
4.2.2
4.2.3
4.2.5
4.2.6
4.2.7
4.2.8
4.3.6
MongoServer
downloads the TAR archive (or ZIP for Windows) based on the
MongoServerBuilder
configuration and unpacks it into the Home directory.
Example:
public class ServerTest
{
[Fact]
public async Task Should_Download_and_Start_Server()
{
// Arrange
MonogServerBuilder builder = new MonogServerBuilder()
.UseMongoVersion(MongoDbVersion.V4_2_0);
// Checks the underlying operating system
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
builder.UseOs(Os.Windows);
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
builder.UseOs(Os.Osx);
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
builder.UseOs(Os.Linux).UseDistribution(Distribution.Ubuntu_1804);
MongoServer mongoServer = new MongoServer(builder)
.UseMongoServerPort(27099);
// Act
await mongoServer.Start();
mongoServer
.Stop()
.Cleanup(); // Remove MongoDB-Data after server stop
// Assert
}
}
TODO
- Command line argument passed to server start
- Pass MongoDB Configuration File
- Configure download & data directory
Product | Versions 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.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- SharpZipLib (>= 1.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.