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.
 
 
 
 
 

59 lines
1.7 KiB

// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschraenkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
using System.Reflection;
using Xunit.Sdk;
namespace Squidex.Domain.Apps.Core.Operations.HandleRules
{
public sealed class ExpressionsAttribute : DataAttribute
{
private readonly string? script;
private readonly string? interpolationOld;
private readonly string? interpolationNew;
private readonly string? liquid;
public ExpressionsAttribute(string? interpolationOld, string? interpolationNew, string? script, string? liquid)
{
this.liquid = liquid;
this.interpolationOld = interpolationOld;
this.interpolationNew = interpolationNew;
this.script = script;
}
public override IEnumerable<object[]> GetData(MethodInfo testMethod)
{
if (interpolationOld != null)
{
yield return new object[] { interpolationOld };
}
if (interpolationNew != null)
{
yield return new object[] { interpolationNew };
}
if (script != null)
{
yield return new object[]
{
$"Script(`{script}`)"
};
}
if (liquid != null)
{
yield return new object[]
{
$"Liquid({liquid})"
};
}
}
}
}