зеркало из https://github.com/Azure/Sia-Gateway.git
merge master onto extendsLinksHeader
This commit is contained in:
Коммит
70d0e5d772
2
domain
2
domain
|
@ -1 +1 @@
|
|||
Subproject commit 3ace8a82be0acb060013a45d60dc65df94759ede
|
||||
Subproject commit 88189e9d1c00490b45a04bb49c2d9cc872338460
|
|
@ -3,7 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<PackageId>Microsoft.Sia.Connectors.Tickets</PackageId>
|
||||
<Version>1.1.11-alpha</Version>
|
||||
<Version>1.1.25-alpha</Version>
|
||||
<Authors>Microsoft</Authors>
|
||||
<Company>Microsoft</Company>
|
||||
<Product>SRE Incident Assistant</Product>
|
||||
|
|
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Sia.Gateway.Tests.TestDoubles
|
||||
{
|
||||
|
@ -27,9 +28,7 @@ namespace Sia.Gateway.Tests.TestDoubles
|
|||
|
||||
if(_contextBeingGenerated.TryAdd(instance, true))
|
||||
{
|
||||
var options = new DbContextOptionsBuilder<IncidentContext>()
|
||||
.UseInMemoryDatabase(instance)
|
||||
.Options;
|
||||
var options = CreateFreshContextAndDb(instance);
|
||||
context = new IncidentContext(options);
|
||||
SeedData.Add(context);
|
||||
_contextBeingGenerated.TryAdd(instance, false);
|
||||
|
@ -42,5 +41,17 @@ namespace Sia.Gateway.Tests.TestDoubles
|
|||
|
||||
private static ConcurrentDictionary<string, bool> _contextBeingGenerated { get; set; } = new ConcurrentDictionary<string, bool>();
|
||||
private static ConcurrentDictionary<string, IncidentContext> _contexts { get; set; } = new ConcurrentDictionary<string, IncidentContext>();
|
||||
|
||||
private static DbContextOptions<IncidentContext> CreateFreshContextAndDb(string instance)
|
||||
{
|
||||
var serviceProvider = new ServiceCollection()
|
||||
.AddEntityFrameworkInMemoryDatabase()
|
||||
.BuildServiceProvider();
|
||||
var builder = new DbContextOptionsBuilder<IncidentContext>()
|
||||
.UseInMemoryDatabase(instance)
|
||||
.UseInternalServiceProvider(serviceProvider);
|
||||
return builder.Options;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче