Xunit.Abstractions.IAttributeInfo.GetNamedArgument(string)

Here are the examples of the csharp api Xunit.Abstractions.IAttributeInfo.GetNamedArgument(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

5 Examples 7

19 Source : Utils.cs
with Apache License 2.0
from Epi-Info

public IEnumerable<TTestCase> OrderTestCases<TTestCase>(IEnumerable<TTestCase> testCases) where TTestCase : ITestCase
		{
			var sortedMethods = new SortedDictionary<int, List<TTestCase>>();

			foreach (TTestCase testCase in testCases)
			{
				int priority = 0;

				foreach (IAttributeInfo attr in testCase.TestMethod.Method.GetCustomAttributes((typeof(TestPriorityAttribute).replacedemblyQualifiedName)))
					priority = attr.GetNamedArgument<int>("Priority");

				GetOrCreate(sortedMethods, priority).Add(testCase);
			}

			foreach (var list in sortedMethods.Keys.Select(priority => sortedMethods[priority]))
			{
				list.Sort((x, y) => StringComparer.OrdinalIgnoreCase.Compare(x.TestMethod.Method.Name, y.TestMethod.Method.Name));
				foreach (TTestCase testCase in list)
					yield return testCase;
			}
		}

19 Source : AdminTestDiscoverer.cs
with MIT License
from microsoft

public IEnumerable<KeyValuePair<string, string>> GetTraits(IAttributeInfo traitAttribute)
        {
            var requirements = traitAttribute.GetNamedArgument<TestRequirements>(nameof(ITestIfSupportedTraitAttribute.Requirements));

            if (requirements.HasFlag(TestRequirements.Admin) 
                || requirements.HasFlag(TestRequirements.JournalScan)
                || requirements.HasFlag(TestRequirements.SymlinkPermission))
            {
                yield return new KeyValuePair<string, string>("Category", RequiresAdmin);
            }
        }

19 Source : DataAdapterDataAttributeDiscoverer.cs
with MIT License
from PacktPublishing

public override bool SupportsDiscoveryEnumeration(IAttributeInfo dataAttribute, IMethodInfo testMethod)
        => dataAttribute.GetNamedArgument<bool>("EnableDiscoveryEnumeration");

19 Source : RetryFactDiscoverer.cs
with MIT License
from stratisproject

public IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
        {
            var maxRetries = factAttribute.GetNamedArgument<int>("MaxRetries");
            if (maxRetries < 1)
                maxRetries = 3;

            var exponentialBackoffMs = Math.Max(0, factAttribute.GetNamedArgument<int>("ExponentialBackoffMs"));

            yield return new RetryTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod, maxRetries, exponentialBackoffMs);
        }

19 Source : RetryFactDiscoverer.cs
with MIT License
from TelegramBots

public IEnumerable<IXunitTestCase> Discover
            (ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
        {
            int maxRetries = factAttribute.GetNamedArgument<int>(nameof(OrderedFactAttribute.MaxRetries));
            int delaySeconds = factAttribute.GetNamedArgument<int>(nameof(OrderedFactAttribute.DelaySeconds));
            string exceptionTypeFullName =
                factAttribute.GetNamedArgument<string>(nameof(OrderedFactAttribute.ExceptionTypeFullName));

            yield return new RetryTestCase
            (_diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod, maxRetries,
                delaySeconds, exceptionTypeFullName);
        }