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.
 
 
 
 
 

42 lines
1.3 KiB

// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using Squidex.ClientLibrary;
using TestSuite.Model;
namespace TestSuite.Fixtures;
public abstract class TestSchemaFixtureBase(string schemaName) : CreatedAppFixture
{
public IContentsClient<TestEntity, TestEntityData> Contents { get; private set; }
public string SchemaName { get; } = schemaName;
public override async ValueTask InitializeAsync()
{
await base.InitializeAsync();
await Factories.CreateAsync($"{nameof(TestEntity)}_{SchemaName}", async () =>
{
try
{
await TestEntity.CreateSchemaAsync(Client.Schemas, SchemaName);
}
catch (SquidexException ex)
{
if (ex.StatusCode != 400)
{
throw;
}
}
return true;
});
Contents = Client.Contents<TestEntity, TestEntityData>(SchemaName);
}
}