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.
47 lines
1.7 KiB
47 lines
1.7 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading.Tasks;
|
|
using FakeItEasy;
|
|
using Squidex.Domain.Apps.Entities.Apps.Commands;
|
|
using Squidex.Domain.Apps.Entities.Schemas.Commands;
|
|
using Squidex.Infrastructure.Commands;
|
|
using Xunit;
|
|
|
|
namespace Squidex.Domain.Apps.Entities.Apps.Templates
|
|
{
|
|
public class TemplatesTests
|
|
{
|
|
private readonly ICommandBus commandBus = A.Fake<ICommandBus>();
|
|
|
|
public static readonly IEnumerable<object[]> TemplateTests = new[]
|
|
{
|
|
new object[] { new CreateBlogCommandMiddleware(), "blog" },
|
|
new object[] { new CreateIdentityCommandMiddleware(), "identity" },
|
|
new object[] { new CreateIdentityV2CommandMiddleware(), "identityV2" },
|
|
new object[] { new CreateProfileCommandMiddleware(), "profile" }
|
|
};
|
|
|
|
[Theory]
|
|
[MemberData(nameof(TemplateTests))]
|
|
public async Task Should_create_schemas(ICommandMiddleware middleware, string template)
|
|
{
|
|
var command = new CreateApp { AppId = Guid.NewGuid(), Name = "my-app", Template = template };
|
|
|
|
var context =
|
|
new CommandContext(command, commandBus)
|
|
.Complete();
|
|
|
|
await middleware.HandleAsync(context);
|
|
|
|
A.CallTo(() => commandBus.PublishAsync(A<CreateSchema>._))
|
|
.MustHaveHappened();
|
|
}
|
|
}
|
|
}
|
|
|