Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

51 lines
1.7 KiB

// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System;
using System.Threading.Tasks;
using EventStore.Client;
using Squidex.Infrastructure.TestHelpers;
namespace Squidex.Infrastructure.EventSourcing
{
public sealed class GetEventStoreFixture : IDisposable
{
private readonly EventStoreClientSettings settings;
public GetEventStore EventStore { get; }
public GetEventStoreFixture()
{
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
settings = EventStoreClientSettings.Create("esdb://admin:changeit@127.0.0.1:2113?tls=false");
EventStore = new GetEventStore(settings, TestUtils.DefaultSerializer);
EventStore.InitializeAsync(default).Wait();
}
public void Dispose()
{
CleanupAsync().Wait();
}
private async Task CleanupAsync()
{
var projectionsManager = new EventStoreProjectionManagementClient(settings);
await foreach (var projection in projectionsManager.ListAllAsync())
{
var name = projection.Name;
if (name.StartsWith("by-squidex-test", StringComparison.OrdinalIgnoreCase))
{
await projectionsManager.DisableAsync(name);
}
}
}
}
}