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.
 
 
 
 
 

37 lines
1.2 KiB

// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using FakeItEasy;
using Squidex.Domain.Apps.Entities.Apps.Commands;
using Squidex.Infrastructure;
using Squidex.Infrastructure.Commands;
using Xunit;
namespace Squidex.Domain.Apps.Entities.Apps.Templates
{
public class AlwaysCreateClientCommandMiddlewareTests
{
private readonly ICommandBus commandBus = A.Fake<ICommandBus>();
[Fact]
public async Task Should_create_client()
{
var command = new CreateApp { AppId = DomainId.NewGuid(), Name = "my-app" };
var context =
new CommandContext(command, commandBus)
.Complete();
var sut = new AlwaysCreateClientCommandMiddleware();
await sut.HandleAsync(context);
A.CallTo(() => commandBus.PublishAsync(A<AttachClient>.That.Matches(x => x.Id == "default")))
.MustHaveHappened();
}
}
}