mirror of https://github.com/Squidex/squidex.git
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.
49 lines
1.5 KiB
49 lines
1.5 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using FakeItEasy;
|
|
using Squidex.Domain.Apps.Entities.TestHelpers;
|
|
using Squidex.Infrastructure;
|
|
using Squidex.Infrastructure.EventSourcing;
|
|
using Xunit;
|
|
|
|
namespace Squidex.Domain.Apps.Entities.Apps
|
|
{
|
|
public class AppEventDeleterTests
|
|
{
|
|
private readonly CancellationTokenSource cts = new CancellationTokenSource();
|
|
private readonly CancellationToken ct;
|
|
private readonly IEventStore eventStore = A.Fake<IEventStore>();
|
|
private readonly AppEventDeleter sut;
|
|
|
|
public AppEventDeleterTests()
|
|
{
|
|
ct = cts.Token;
|
|
|
|
sut = new AppEventDeleter(eventStore);
|
|
}
|
|
|
|
[Fact]
|
|
public void Should_run_last()
|
|
{
|
|
var order = sut.Order;
|
|
|
|
Assert.Equal(int.MaxValue, order);
|
|
}
|
|
|
|
[Fact]
|
|
public async Task Should_remove_events_from_streams()
|
|
{
|
|
var app = Mocks.App(NamedId.Of(DomainId.NewGuid(), "my-app"));
|
|
|
|
await sut.DeleteAppAsync(app, ct);
|
|
|
|
A.CallTo(() => eventStore.DeleteAsync($"^[a-zA-Z0-9]-{app.Id}", A<CancellationToken>._))
|
|
.MustNotHaveHappened();
|
|
}
|
|
}
|
|
}
|
|
|