Files
Umbraco-CMS/tests/Umbraco.Tests.Integration/Attributes/ConfigureBuilderAttribute.cs
Sven Geusens 1cd9e3e83f Fix variant invariancy with limited language (#17707)
* Add a way to configure IUmbracobuilder on a per testcase basis

* New logic for invariantVariantMerging

* bugfix

* Undo formatting changes

* Undo more automatic formatting

* Last automatic formatting correction

* Cleanup ConfigureBuilderAttribute

* Made propertyEditor tests internal
2025-01-06 14:58:00 +01:00

31 lines
1.0 KiB
C#

using NUnit.Framework;
namespace Umbraco.Cms.Tests.Integration.Attributes;
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class ConfigureBuilderAttribute : Attribute
{
public string ActionName { get; set; }
public void Execute(IUmbracoBuilder builder)
{
// todo allow to find methods from parents
Type.GetType(TestContext.CurrentContext.Test.ClassName).GetMethods().First(method => method.Name == ActionName)
.Invoke(null, [builder]);
}
}
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class ConfigureBuilderTestCaseAttribute : Attribute
{
public string ActionName { get; set; }
public int IndexOfParameter { get; set; }
public void Execute(IUmbracoBuilder builder)
{
Type.GetType(TestContext.CurrentContext.Test.ClassName).GetMethods().First(method => method.Name == ActionName)
.Invoke(null, [builder, TestContext.CurrentContext.Test.Arguments[IndexOfParameter]]);
}
}