23 lines
817 B
C#
23 lines
817 B
C#
using Microsoft.Extensions.Configuration;
|
|
using System.Collections.Generic;
|
|
|
|
namespace ManagerService.Tests.Infrastructure
|
|
{
|
|
/// <summary>
|
|
/// IConfiguration avec une fausse connexion MongoDB pour instancier les
|
|
/// DatabaseService dont le code actif des contrôleurs ne se sert plus
|
|
/// (remplacé par EF Core), mais dont le constructeur en a besoin.
|
|
/// MongoClient est lazy : aucune connexion réelle ne sera tentée.
|
|
/// </summary>
|
|
public static class FakeMongoConfig
|
|
{
|
|
public static IConfiguration Create() =>
|
|
new ConfigurationBuilder()
|
|
.AddInMemoryCollection(new Dictionary<string, string?>
|
|
{
|
|
["ConnectionStrings:TabletDb"] = "mongodb://localhost:27017"
|
|
})
|
|
.Build();
|
|
}
|
|
}
|