diff --git a/src/NetEvolve.Extensions.XUnit.V3/Internal/CultureAttributeBase.cs b/src/NetEvolve.Extensions.XUnit.V3/Internal/CultureAttributeBase.cs
deleted file mode 100644
index 968eb3d..0000000
--- a/src/NetEvolve.Extensions.XUnit.V3/Internal/CultureAttributeBase.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-namespace NetEvolve.Extensions.XUnit.V3.Internal;
-
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Reflection;
-using System.Threading.Tasks;
-using Xunit.v3;
-
-///
-/// Abstract class implementation of .
-/// Provides basic functionality for culture-based testing.
-///
-[AttributeUsage(
- AttributeTargets.Class | AttributeTargets.Method,
- AllowMultiple = true,
- Inherited = true
-)]
-//[TraitDiscoverer(Namespaces.CultureTraitDiscoverer, Namespaces.Assembly)]
-#pragma warning disable S3376 // Attribute, EventArgs, and Exception type names should end with the type being extended
-#pragma warning disable CA1710 // Identifiers should have correct suffix
-public abstract class CultureAttributeBase : Attribute, IBeforeAfterTestAttribute, ITraitAttribute
-#pragma warning restore CA1710 // Identifiers should have correct suffix
-#pragma warning restore S3376 // Attribute, EventArgs, and Exception type names should end with the type being extended
-{
- private readonly CultureInfo _culture;
-
- private CultureInfo? _originalCulture;
- private bool _changed;
-
- ///
- /// Category
- ///
- public string Category { get; }
-
- ///
- /// Culture
- ///
- public string Culture { get; }
-
- ///
- protected CultureAttributeBase(string category, string culture)
- {
- Category = category;
- Culture = culture;
- _culture = CreateCultureInfo(culture);
- }
-
- ///
- public virtual ValueTask After(MethodInfo methodUnderTest, IXunitTest test)
- {
- if (_changed)
- {
- _ = SetCulture(_originalCulture!);
- }
-
- return new ValueTask();
- }
-
- ///
- public virtual ValueTask Before(MethodInfo methodUnderTest, IXunitTest test)
- {
- _originalCulture = CultureInfo.CurrentCulture;
-
- _changed = SetCulture(_culture);
-
- return new ValueTask();
- }
-
- private protected static CultureInfo CreateCultureInfo(string culture) =>
- new CultureInfo(culture, false);
-
- private protected virtual bool SetCulture(CultureInfo culture)
- {
- if (CultureInfo.CurrentCulture != culture)
- {
- CultureInfo.CurrentCulture = culture;
- CultureInfo.DefaultThreadCurrentCulture = culture;
- return true;
- }
-
- return false;
- }
-
- ///
- public abstract IReadOnlyCollection> GetTraits();
-}
diff --git a/src/NetEvolve.Extensions.XUnit.V3/SetCultureAttribute.cs b/src/NetEvolve.Extensions.XUnit.V3/SetCultureAttribute.cs
deleted file mode 100644
index 60615ec..0000000
--- a/src/NetEvolve.Extensions.XUnit.V3/SetCultureAttribute.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-namespace NetEvolve.Extensions.XUnit.V3;
-
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Reflection;
-using System.Threading.Tasks;
-using NetEvolve.Extensions.XUnit.V3.Internal;
-using Xunit.Internal;
-using Xunit.v3;
-
-///
-/// Based on the value passed as culture, the marked test is executed.
-///
-[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = false)]
-public sealed class SetCultureAttribute : CultureAttributeBase
-{
- private readonly CultureInfo _uiCulture;
- private CultureInfo? _originalUICulture;
- private bool _changed;
-
- ///
- /// UI culture
- ///
- public string? UICulture { get; }
-
- ///
- /// Initializes a new instance of the class.
- ///
- public SetCultureAttribute()
- : this(string.Empty, string.Empty) { }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Culture to use.
- public SetCultureAttribute(string culture)
- : this(culture, culture) { }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Culture to use.
- /// UI culture to use.
- public SetCultureAttribute(string culture, string? uiCulture)
- : base("SetCulture", culture)
- {
- if (string.IsNullOrWhiteSpace(uiCulture))
- {
- uiCulture = string.Empty;
- }
-
- _uiCulture = CreateCultureInfo(uiCulture!);
- }
-
- ///
- public override async ValueTask After(MethodInfo methodUnderTest, IXunitTest test)
- {
- await base.After(methodUnderTest, test).ConfigureAwait(false);
-
- if (_changed)
- {
- _ = SetUICulture(_originalUICulture!);
- }
- }
-
- ///
- public override async ValueTask Before(MethodInfo methodUnderTest, IXunitTest test)
- {
- await base.Before(methodUnderTest, test).ConfigureAwait(false);
-
- _originalUICulture = CultureInfo.CurrentUICulture;
- _changed = SetUICulture(_uiCulture);
- }
-
- private static bool SetUICulture(CultureInfo culture)
- {
- if (CultureInfo.CurrentUICulture != culture)
- {
- CultureInfo.CurrentUICulture = culture;
- CultureInfo.DefaultThreadCurrentUICulture = culture;
-
- return true;
- }
-
- return false;
- }
-
- ///
- public override IReadOnlyCollection> GetTraits()
- {
- var result = new Dictionary(StringComparer.OrdinalIgnoreCase)
- {
- { "SetCulture", Culture },
- { "SetUICulture", Culture },
- };
-
- return result.CastOrToReadOnlyList();
- }
-}
diff --git a/src/NetEvolve.Extensions.XUnit.V3/SetUICultureAttribute.cs b/src/NetEvolve.Extensions.XUnit.V3/SetUICultureAttribute.cs
deleted file mode 100644
index 9948dc3..0000000
--- a/src/NetEvolve.Extensions.XUnit.V3/SetUICultureAttribute.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-namespace NetEvolve.Extensions.XUnit.V3;
-
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using NetEvolve.Extensions.XUnit.V3.Internal;
-using Xunit.Internal;
-
-///
-/// Based on the value passed as UI culture, the marked test is executed.
-///
-[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = false)]
-public sealed class SetUICultureAttribute : CultureAttributeBase
-{
- ///
- /// Initializes a new instance of the class.
- ///
- public SetUICultureAttribute()
- : base("SetUICulture", string.Empty) { }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// UI culture to use.
- public SetUICultureAttribute(string culture)
- : base("SetUICulture", culture) { }
-
- private protected override bool SetCulture(CultureInfo culture)
- {
- if (CultureInfo.CurrentUICulture != culture)
- {
- CultureInfo.CurrentUICulture = culture;
- CultureInfo.DefaultThreadCurrentUICulture = culture;
- return true;
- }
-
- return false;
- }
-
- ///
- public override IReadOnlyCollection> GetTraits()
- {
- var result = new Dictionary(StringComparer.OrdinalIgnoreCase)
- {
- { "SetUICulture", Culture },
- };
-
- return result.CastOrToReadOnlyList();
- }
-}
diff --git a/tests/NetEvolve.Extensions.XUnit.V3.Tests.PublicApi/_snapshots/DotNet6_0/PublicApiTests.PublicApi_HasNotChanged_Expected.verified.txt b/tests/NetEvolve.Extensions.XUnit.V3.Tests.PublicApi/_snapshots/DotNet6_0/PublicApiTests.PublicApi_HasNotChanged_Expected.verified.txt
index 953dc14..2d8cfae 100644
--- a/tests/NetEvolve.Extensions.XUnit.V3.Tests.PublicApi/_snapshots/DotNet6_0/PublicApiTests.PublicApi_HasNotChanged_Expected.verified.txt
+++ b/tests/NetEvolve.Extensions.XUnit.V3.Tests.PublicApi/_snapshots/DotNet6_0/PublicApiTests.PublicApi_HasNotChanged_Expected.verified.txt
@@ -60,22 +60,6 @@
{
public PreDeploymentAttribute() { }
}
- public sealed class SetCultureAttribute : NetEvolve.Extensions.XUnit.V3.Internal.CultureAttributeBase
- {
- public SetCultureAttribute() { }
- public SetCultureAttribute(string culture) { }
- public SetCultureAttribute(string culture, string? uiCulture) { }
- public string? UICulture { get; }
- public override System.Threading.Tasks.ValueTask After(System.Reflection.MethodInfo methodUnderTest, Xunit.v3.IXunitTest test) { }
- public override System.Threading.Tasks.ValueTask Before(System.Reflection.MethodInfo methodUnderTest, Xunit.v3.IXunitTest test) { }
- public override System.Collections.Generic.IReadOnlyCollection> GetTraits() { }
- }
- public sealed class SetUICultureAttribute : NetEvolve.Extensions.XUnit.V3.Internal.CultureAttributeBase
- {
- public SetUICultureAttribute() { }
- public SetUICultureAttribute(string culture) { }
- public override System.Collections.Generic.IReadOnlyCollection> GetTraits() { }
- }
public sealed class UnitTestAttribute : NetEvolve.Extensions.XUnit.V3.Internal.CategoryTraitBaseAttribute
{
public UnitTestAttribute() { }
@@ -109,13 +93,4 @@ namespace NetEvolve.Extensions.XUnit.V3.Internal
public string? Id { get; }
public System.Collections.Generic.IReadOnlyCollection> GetTraits() { }
}
- public abstract class CultureAttributeBase : System.Attribute, Xunit.v3.IBeforeAfterTestAttribute, Xunit.v3.ITraitAttribute
- {
- protected CultureAttributeBase(string category, string culture) { }
- public string Category { get; }
- public string Culture { get; }
- public virtual System.Threading.Tasks.ValueTask After(System.Reflection.MethodInfo methodUnderTest, Xunit.v3.IXunitTest test) { }
- public virtual System.Threading.Tasks.ValueTask Before(System.Reflection.MethodInfo methodUnderTest, Xunit.v3.IXunitTest test) { }
- public abstract System.Collections.Generic.IReadOnlyCollection> GetTraits();
- }
}
\ No newline at end of file
diff --git a/tests/NetEvolve.Extensions.XUnit.V3.Tests.PublicApi/_snapshots/DotNet8_0/PublicApiTests.PublicApi_HasNotChanged_Expected.verified.txt b/tests/NetEvolve.Extensions.XUnit.V3.Tests.PublicApi/_snapshots/DotNet8_0/PublicApiTests.PublicApi_HasNotChanged_Expected.verified.txt
index 953dc14..2d8cfae 100644
--- a/tests/NetEvolve.Extensions.XUnit.V3.Tests.PublicApi/_snapshots/DotNet8_0/PublicApiTests.PublicApi_HasNotChanged_Expected.verified.txt
+++ b/tests/NetEvolve.Extensions.XUnit.V3.Tests.PublicApi/_snapshots/DotNet8_0/PublicApiTests.PublicApi_HasNotChanged_Expected.verified.txt
@@ -60,22 +60,6 @@
{
public PreDeploymentAttribute() { }
}
- public sealed class SetCultureAttribute : NetEvolve.Extensions.XUnit.V3.Internal.CultureAttributeBase
- {
- public SetCultureAttribute() { }
- public SetCultureAttribute(string culture) { }
- public SetCultureAttribute(string culture, string? uiCulture) { }
- public string? UICulture { get; }
- public override System.Threading.Tasks.ValueTask After(System.Reflection.MethodInfo methodUnderTest, Xunit.v3.IXunitTest test) { }
- public override System.Threading.Tasks.ValueTask Before(System.Reflection.MethodInfo methodUnderTest, Xunit.v3.IXunitTest test) { }
- public override System.Collections.Generic.IReadOnlyCollection> GetTraits() { }
- }
- public sealed class SetUICultureAttribute : NetEvolve.Extensions.XUnit.V3.Internal.CultureAttributeBase
- {
- public SetUICultureAttribute() { }
- public SetUICultureAttribute(string culture) { }
- public override System.Collections.Generic.IReadOnlyCollection> GetTraits() { }
- }
public sealed class UnitTestAttribute : NetEvolve.Extensions.XUnit.V3.Internal.CategoryTraitBaseAttribute
{
public UnitTestAttribute() { }
@@ -109,13 +93,4 @@ namespace NetEvolve.Extensions.XUnit.V3.Internal
public string? Id { get; }
public System.Collections.Generic.IReadOnlyCollection> GetTraits() { }
}
- public abstract class CultureAttributeBase : System.Attribute, Xunit.v3.IBeforeAfterTestAttribute, Xunit.v3.ITraitAttribute
- {
- protected CultureAttributeBase(string category, string culture) { }
- public string Category { get; }
- public string Culture { get; }
- public virtual System.Threading.Tasks.ValueTask After(System.Reflection.MethodInfo methodUnderTest, Xunit.v3.IXunitTest test) { }
- public virtual System.Threading.Tasks.ValueTask Before(System.Reflection.MethodInfo methodUnderTest, Xunit.v3.IXunitTest test) { }
- public abstract System.Collections.Generic.IReadOnlyCollection> GetTraits();
- }
}
\ No newline at end of file
diff --git a/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/SetCultureAttributeTests.cs b/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/SetCultureAttributeTests.cs
deleted file mode 100644
index 7117037..0000000
--- a/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/SetCultureAttributeTests.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-namespace NetEvolve.Extensions.XUnit.V3.Tests.Unit;
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Threading.Tasks;
-using Xunit;
-
-[ExcludeFromCodeCoverage]
-public class SetCultureAttributeTests : AttributeTestsBase
-{
- [Fact]
- [SetCulture("en")]
- public async Task Execute_English()
- {
- var traits = GetTraits();
- var translations = new Dictionary(StringComparer.OrdinalIgnoreCase)
- {
- { "Translation", Translations.HelloWorld },
- };
-
- _ = await Verify(traits.Union(translations));
- }
-
- [Fact]
- [SetCulture]
- public async Task Execute_Invariant()
- {
- var traits = GetTraits();
- var translations = new Dictionary(StringComparer.OrdinalIgnoreCase)
- {
- { "Translation", Translations.HelloWorld },
- };
-
- _ = await Verify(traits.Union(translations));
- }
-
- [Fact]
- [SetCulture("de")]
- public async Task Execute_German()
- {
- var traits = GetTraits();
- var translations = new Dictionary(StringComparer.OrdinalIgnoreCase)
- {
- { "Translation", Translations.HelloWorld },
- };
-
- _ = await Verify(traits.Union(translations));
- }
-
- [Fact]
- [SetCulture("de-DE")]
- public async Task Execute_German_Germany()
- {
- var traits = GetTraits();
- var translations = new Dictionary(StringComparer.OrdinalIgnoreCase)
- {
- { "Translation", Translations.HelloWorld },
- };
-
- _ = await Verify(traits.Union(translations));
- }
-}
diff --git a/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/SetUICultureAttributeTests.cs b/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/SetUICultureAttributeTests.cs
deleted file mode 100644
index f02c920..0000000
--- a/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/SetUICultureAttributeTests.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-namespace NetEvolve.Extensions.XUnit.V3.Tests.Unit;
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Threading.Tasks;
-using Xunit;
-
-[ExcludeFromCodeCoverage]
-public class SetUICultureAttributeTests : AttributeTestsBase
-{
- [Fact(Skip = "Flaky, will deal with this later.")]
- [SetUICulture("en")]
- public async Task Execute_English()
- {
- var traits = GetTraits();
- var translations = new Dictionary(StringComparer.OrdinalIgnoreCase)
- {
- { "Translation", Translations.HelloWorld },
- };
-
- _ = await Verify(traits.Union(translations));
- }
-
- [Fact]
- [SetUICulture]
- public async Task Execute_Invariant()
- {
- var traits = GetTraits();
- var translations = new Dictionary(StringComparer.OrdinalIgnoreCase)
- {
- { "Translation", Translations.HelloWorld },
- };
-
- _ = await Verify(traits.Union(translations));
- }
-
- [Fact(Skip = "Flaky, will deal with this later.")]
- [SetUICulture("de")]
- public async Task Execute_German()
- {
- var traits = GetTraits();
- var translations = new Dictionary(StringComparer.OrdinalIgnoreCase)
- {
- { "Translation", Translations.HelloWorld },
- };
-
- _ = await Verify(traits.Union(translations));
- }
-
- [Fact]
- [SetUICulture("de-DE")]
- public async Task Execute_German_Germany()
- {
- var traits = GetTraits();
- var translations = new Dictionary(StringComparer.OrdinalIgnoreCase)
- {
- { "Translation", Translations.HelloWorld },
- };
-
- _ = await Verify(traits.Union(translations));
- }
-}
diff --git a/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/Translations.Designer.cs b/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/Translations.Designer.cs
deleted file mode 100644
index 091ca67..0000000
--- a/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/Translations.Designer.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace NetEvolve.Extensions.XUnit.V3.Tests.Unit {
- using System;
-
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Translations {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Translations() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NetEvolve.Extensions.XUnit.V3.Tests.Unit.Translations", typeof(Translations).Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized string similar to Hello World!.
- ///
- internal static string HelloWorld {
- get {
- return ResourceManager.GetString("HelloWorld", resourceCulture);
- }
- }
- }
-}
diff --git a/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/Translations.de.resx b/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/Translations.de.resx
deleted file mode 100644
index fd4242b..0000000
--- a/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/Translations.de.resx
+++ /dev/null
@@ -1,123 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- Hallo Welt!
-
-
\ No newline at end of file
diff --git a/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/Translations.resx b/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/Translations.resx
deleted file mode 100644
index f36015b..0000000
--- a/tests/NetEvolve.Extensions.XUnit.V3.Tests.Unit/Translations.resx
+++ /dev/null
@@ -1,123 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- Hello World!
-
-
\ No newline at end of file