}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public async Task ReadAsync_DuringReadAsync()
{
byte[] buffer = new byte[32];
File.WriteAllText(secretsFilePath, contents.ToString(), Encoding.UTF8);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34580", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
public void AddUserSecrets_FindsAssemblyAttribute()
{
Assert.Equal(randValue, config[configKey]);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34580", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
public void AddUserSecrets_FindsAssemblyAttributeFromType()
{
Assert.Empty(config.AsEnumerable());
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34580", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
public void AddUserSecrets_With_SecretsId_Passed_Explicitly()
{
Assert.False(error.Message.Contains(_basePath), error.Message);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34580", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
public void LoadAndCombineKeyValuePairsFromDifferentConfigurationProviders()
{
Assert.Equal("MemValue6", config["CommonKey1:CommonKey2:CommonKey3:CommonKey4"]);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34580", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
public void LoadAndCombineKeyValuePairsFromDifferentConfigurationProvidersWithAbsolutePath()
{
Assert.Equal("MemValue6", config["CommonKey1:CommonKey2:CommonKey3:CommonKey4"]);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34580", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
public void CanOverrideValuesWithNewConfigurationProvider()
{
Assert.NotNull(provider);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34580", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
public void OnLoadErrorWillBeCalledOnIniLoadError()
{
Assert.True(createAgainToken.HasChanged);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34580", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
public void LoadIncorrectJsonFile_ThrowException()
{
Assert.Contains("Could not parse the JSON file.", exception.Message);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/34580", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
public void SetBasePathCalledMultipleTimesForEachSourceLastOneWins()
{
Assert.Same(expected[7], handler);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task Factory_CreateClient_WithExpiry_CanExpire()
{
// Arrange
Assert.NotSame(activeEntry1.Handler, activeEntry2.Handler);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task Factory_CreateClient_WithExpiry_HandlerCanBeReusedBeforeExpiry()
{
// Arrange
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
{
public class RedactedLogValueIntegrationTest
{
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public async Task RedactHeaderValueWithHeaderList_ValueIsRedactedBeforeLogging()
{
// Arrange
", message.Message);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public async Task RedactHeaderValueWithPredicate_ValueIsRedactedBeforeLogging()
{
// Arrange
Assert.Equal(TestConsole.DefaultForegroundColor, write.ForegroundColor);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void WriteError_LogsCorrectColors()
{
// Arrange
Assert.Equal(TestConsole.DefaultForegroundColor, write.ForegroundColor);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void WriteDebug_LogsCorrectColors()
{
// Arrange
}
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(FormatsAndLevels))]
public void WriteCore_LogsCorrectTimestampInUtc(ConsoleLoggerFormat format, LogLevel level)
{
Assert.Equal(TestConsole.DefaultForegroundColor, write.ForegroundColor);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void WritingScopes_LogsWithCorrectColors()
{
// Arrange
{
public class BlockingCollectionCancellationTests
{
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void InternalCancellation_CompleteAdding_Negative()
{
BlockingCollection<int> coll1 = new BlockingCollection<int>();
}
//This tests that Take/TryTake wake up correctly if CompleteAdding() is called while waiting
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void InternalCancellation_WakingUp()
{
for (int test = 0; test < 2; test++)
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void ExternalCancel_Negative()
{
BlockingCollection<int> bc = new BlockingCollection<int>(); //empty collection.
cs.Token);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void ExternalCancel_AddToAny()
{
for (int test = 0; test < 3; test++)
protected override string CopyToNoLengthParamName => "index";
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(1, 10)]
[InlineData(3, 100)]
[InlineData(8, 1000)]
Assert.Equal(itemsPerThread * threadsCount, bag.Count);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void AddOnOneThread_PeekOnAnother_EnsureWeCanTakeOnTheOriginal()
{
var bag = new ConcurrentBag<int>(Enumerable.Range(1, 5));
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void AddManyItems_ThenTakeOnDifferentThread_ItemsOutputInExpectedOrder()
{
var bag = new ConcurrentBag<int>(Enumerable.Range(0, 100000));
}, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default).GetAwaiter().GetResult();
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void SingleProducerAdding_MultiConsumerTaking_SemaphoreThrottling_AllTakesSucceed()
{
var bag = new ConcurrentBag<int>();
ce.Wait();
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(0)]
[InlineData(1)]
[InlineData(10)]
Assert.Throws<InvalidCastException>(() => c.CopyTo(new ArgumentNullException[Size], 0));
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(0)]
[InlineData(1)]
[InlineData(10)]
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(false, 0)]
[InlineData(false, 1)]
[InlineData(false, 20)]
}
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(1, 10)]
[InlineData(3, 100)]
[InlineData(8, 1000)]
Task.WaitAll(producer, consumer);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void Concurrent_Enqueue_TryPeek_TryDequeue_AllItemsSeen()
{
int items = 1000;
Assert.True(s.IsEmpty);
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(8, 10)]
[InlineData(16, 100)]
[InlineData(128, 100)]
}
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(8, 10)]
[InlineData(16, 100)]
[InlineData(128, 100)]
{
public class PartitionerStaticTests
{
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void TestStaticPartitioningIList()
{
RunTestWithAlgorithm(dataSize: 11, partitionCount: 8, algorithm: 0);
RunTestWithAlgorithm(dataSize: 10000, partitionCount: 11, algorithm: 0);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void TestStaticPartitioningArray()
{
RunTestWithAlgorithm(dataSize: 7, partitionCount: 4, algorithm: 1);
RunTestWithAlgorithm(dataSize: 1000, partitionCount: 7, algorithm: 1);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void TestLoadBalanceIList()
{
RunTestWithAlgorithm(dataSize: 7, partitionCount: 4, algorithm: 2);
RunTestWithAlgorithm(dataSize: 1000, partitionCount: 7, algorithm: 2);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void TestLoadBalanceArray()
{
RunTestWithAlgorithm(dataSize: 11, partitionCount: 8, algorithm: 3);
RunTestWithAlgorithm(dataSize: 10000, partitionCount: 11, algorithm: 3);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void TestLoadBalanceEnumerator()
{
RunTestWithAlgorithm(dataSize: 7, partitionCount: 4, algorithm: 4);
AssertSetsEqual(expected, actual);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void Add_TakeFromAnotherThread_ExpectedItemsTaken()
{
IProducerConsumerCollection<int> c = CreateProducerConsumerCollection();
Assert.Equal(oracle.Count, c.Count);
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(100, 1, 100, true)]
[InlineData(100, 4, 10, false)]
[InlineData(1000, 11, 100, true)]
private const int TimeoutShort = 300;
private const int TimeoutLong = 30000;
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void TestBackgroundWorkerBasic()
{
var orignal = SynchronizationContext.Current;
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task RunWorkerAsync_NoOnWorkHandler_SetsResultToNull()
{
var tcs = new TaskCompletionSource();
private ManualResetEventSlim manualResetEvent3;
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void TestCancelAsync()
{
BackgroundWorker bw = new BackgroundWorker();
#endregion
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void TestThrowExceptionInDoWork()
{
var original = SynchronizationContext.Current;
Assert.False(bw.CancellationPending);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void RunWorkerAsyncTwice()
{
var bw = new BackgroundWorker();
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void TestCancelInsideDoWork()
{
var original = SynchronizationContext.Current;
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/37136", typeof(PlatformDetection), nameof(PlatformDetection.IsNotMonoInterpreter))]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/37136", TestPlatforms.Browser)]
public void TestFinalization()
{
// BackgroundWorker has a finalizer that exists purely for backwards compatibility
{
public class CommandBuilderTests : IntegrationTestBase
{
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [ConditionalFact]
public void QuoteIdentifier_UseConnection()
{
var commandBuilder = new OdbcCommandBuilder();
Assert.Throws<InvalidOperationException>(() => commandBuilder.UnquoteIdentifier("Test"));
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [ConditionalFact]
public void QuoteIdentifier_CustomPrefixSuffix()
{
var commandBuilder = new OdbcCommandBuilder();
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
using Xunit;
namespace System.Data.Odbc.Tests
{
public class DependencyCheckTest
{
- public static bool IsObdcNotAvailableAndThreadingSupported => Helpers.CheckOdbcNotAvailable() && PlatformDetection.IsThreadingSupported;
- [ConditionalFact(nameof(IsObdcNotAvailableAndThreadingSupported))]
+ [ConditionalFact(Helpers.OdbcNotAvailable)]
public void OdbcConnection_OpenWhenOdbcNotInstalled_ThrowsException()
{
if (PlatformDetection.IsWindowsServerCore && !Environment.Is64BitProcess)
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void TestConnectionSchemaOnNonOpenConnection()
{
using (OdbcConnection connection = new OdbcConnection(string.Empty))
{
public class ReaderTests : IntegrationTestBase
{
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [ConditionalFact]
public void EmptyReader()
{
command.CommandText =
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [ConditionalFact]
public void GetValues()
{
command.CommandText =
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [ConditionalFact]
public void GetValueFailsWithBigIntWithBackwardsCompatibility()
{
command.CommandText =
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [ConditionalFact]
public void GetDataTypeName()
{
command.CommandText =
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [ConditionalFact]
public void GetFieldTypeIsNotSupportedInSqlite()
{
command.CommandText =
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [ConditionalFact]
public void IsDbNullIsNotSupportedInSqlite()
{
command.CommandText =
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [ConditionalFact]
public void InvalidRowIndex()
{
command.CommandText =
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [ConditionalFact]
public void InvalidRowName()
{
command.CommandText =
{
public class SmokeTest : IntegrationTestBase
{
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [ConditionalFact]
public void CreateInsertSelectTest()
{
command.CommandText =
/// <summary>
/// Tests Id generation
/// </summary>
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void IdGenerationNoParent()
{
var orphan1 = new Activity("orphan1");
/// <summary>
/// Tests Id generation
/// </summary>
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void IdGenerationInternalParent()
{
var parent = new Activity("parent");
/// <summary>
/// Tests that Activity.Current flows correctly within async methods
/// </summary>
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ActivityCurrentFlowsWithAsyncSimple()
{
Activity activity = new Activity("activity").Start();
/// <summary>
/// Tests that Activity.Current flows correctly within async methods
/// </summary>
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ActivityCurrentFlowsWithAsyncComplex()
{
Activity originalActivity = Activity.Current;
/// <summary>
/// Tests that Activity.Current could be set
/// </summary>
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ActivityCurrentSet()
{
Activity activity = new Activity("activity");
Assert.False(Process.GetCurrentProcess().WaitForExit(milliseconds));
}
- [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Theory]
[InlineData(0)] // poll
[InlineData(10)] // real timeout
public async Task CurrentProcess_WaitAsyncNeverCompletes(int milliseconds)
Assert.Equal(id, Trace.CorrelationManager.ActivityId);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task CorrelationManager_MutateStackPush()
{
Guid id = Guid.NewGuid();
ValidateStack(Trace.CorrelationManager.LogicalOperationStack, 2, 1);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task CorrelationManager_MutateStackPop()
{
Guid id = Guid.NewGuid();
ValidateStack(Trace.CorrelationManager.LogicalOperationStack, Array.Empty<object>());
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task CorrelationManager_ActivityIdAcrossAwait()
{
Guid g = Guid.NewGuid();
Assert.Equal(g, Trace.CorrelationManager.ActivityId);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task CorrelationManager_CorrelationAcrossAwait()
{
Guid g = Guid.NewGuid();
Assert.Equal(expected, listener.WriteCount);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
[MethodImpl(MethodImplOptions.NoInlining)]
public void WriteFooterTest_Callstack()
{
Assert.Equal(new string[] { "" }, await ReadAsync(path));
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task EmptyStringCreatesFileAsync()
{
string path = GetTestFilePath();
Assert.Empty(await ReadAsync(path));
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(0)]
[InlineData(100)]
public async Task ValidWriteAsync(int size)
public Task NonExistentPathAsync() => Assert.ThrowsAsync<DirectoryNotFoundException>(
async () => await WriteAsync(Path.Combine(TestDirectory, GetTestFileName(), GetTestFileName()), "Text"));
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task NullContent_CreatesFileAsync()
{
string path = GetTestFilePath();
}
}
- [Theory] // inner loop, just a few cases
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] // inner loop, just a few cases
[InlineData(false, false)]
[InlineData(true, false)]
[InlineData(true, true)]
bufferSize: 4096, writeSize: 1024, numWrites: 10);
}
- [Theory] // outer loop, many combinations
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] // outer loop, many combinations
[OuterLoop]
[MemberData(nameof(File_AllDataCopied_MemberData))]
public async Task File_AllDataCopied(
}
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(false)]
[InlineData(true)]
public async Task DerivedFileStream_ReadAsyncInvoked(bool useAsync)
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAsyncCancelledFile()
{
string fileName = GetTestFilePath();
Assert.Throws<ObjectDisposedException>(() => { fs.WriteAsync(new ReadOnlyMemory<byte>(new byte[1])); });
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task EmptyFile_ReadAsync_Succeeds()
{
using (var fs = CreateFileStream(GetTestFilePath(), FileMode.Create))
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task NonEmptyFile_ReadAsync_GetsExpectedData()
{
string fileName = GetTestFilePath();
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task NonEmptyFile_CustomMemoryManager_ReadAsync_GetsExpectedData()
{
string fileName = GetTestFilePath();
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task NonEmptyWriteAsync_WritesExpectedData()
{
using (var fs = CreateFileStream(GetTestFilePath(), FileMode.Create))
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task NonEmptyWriteAsync_CustomMemoryManager_WritesExpectedData()
{
using (var mem = new NativeMemoryManager(TestBuffer.Length))
AssertExtensions.Throws<ArgumentOutOfRangeException>("options", () => CreateFileStream(GetTestFilePath(), FileMode.Create, FileAccess.ReadWrite, FileShare.Read, c_DefaultBufferSize, ~FileOptions.None));
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(FileOptions.None)]
[InlineData(FileOptions.DeleteOnClose)]
[InlineData(FileOptions.RandomAccess)]
}
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(FileOptions.Encrypted)]
[InlineData(FileOptions.Asynchronous | FileOptions.Encrypted)]
[InlineData(FileOptions.Asynchronous | FileOptions.DeleteOnClose | FileOptions.Encrypted | FileOptions.RandomAccess | FileOptions.SequentialScan | FileOptions.WriteThrough)]
{
public class FlushAsyncCancellationTests : PipeTest
{
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void FlushAsyncCancellationDeadlock()
{
var cts = new CancellationTokenSource();
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task UseSynchronizationContextFalseIgnoresSyncContextForReaderScheduler()
{
SynchronizationContext previous = SynchronizationContext.Current;
Assert.Equal(0, wrapper.TimesCalled(nameof(wrapper.FlushAsync)));
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(true, true)]
[InlineData(true, false)]
[InlineData(false, true)]
}
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData("\r\n")]
[InlineData("\n")]
[InlineData("newline")]
{
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void BeginEndReadTest()
{
Stream stream = CreateStream();
stream.EndRead(result);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void BeginEndWriteTest()
{
Stream stream = CreateStream();
Assert.InRange(outerCount, 1, int.MaxValue); // the buffer can't be size 0
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task AsyncIfCanSeekIsFalseLengthAndPositionShouldNotBeCalled()
{
var baseStream = new DelegateStream(
Assert.InRange(outerCount, 1, int.MaxValue);
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(LengthIsLessThanOrEqualToPosition))]
public async Task AsyncIfLengthIsLessThanOrEqualToPositionCopyToShouldStillBeCalledWithAPositiveBufferSize(long length, long position)
{
Assert.InRange(outerCount, 1, int.MaxValue);
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(LengthMinusPositionPositiveOverflows))]
public async Task AsyncIfLengthMinusPositionPositiveOverflowsBufferSizeShouldStillBePositive(long length, long position)
{
Assert.Equal(ReadLimit - 1, dest.TimesCalled(nameof(dest.Write)));
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(LengthIsGreaterThanPositionAndDoesNotOverflow))]
public async Task AsyncIfLengthIsGreaterThanPositionAndDoesNotOverflowEverythingShouldGoNormally(long length, long position)
{
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadBlockAsyncCharArr()
{
(char[] chArr, CharArrayTextReader textReader) baseInfo = GetCharArray();
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAsync()
{
(char[] chArr, CharArrayTextReader textReader) baseInfo = GetCharArray();
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadLineAsyncContinuousNewLinesAndTabs()
{
char[] newLineTabData = new char[] { '\n', '\n', '\r', '\r', '\n' };
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task WriteAsyncStringTest()
{
using (CharArrayTextWriter tw = NewTextWriter)
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task WriteLineCharMemoryTest()
{
using (CharArrayTextWriter tw = NewTextWriter)
// On CTP-M1, this would deadlock for DOP=7,9,11,... on 4-core, but works for DOP=1..6 and 8,10,12, ...
//
// In this test, every call to the key-selector delegate throws.
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(OrderByThreadedData), new[] { 1, 2, 16, 128, 1024 }, new[] { 1, 2, 4, 7, 8, 31, 32 })]
public static void OrderBy_ThreadedDeadlock(Labeled<ParallelQuery<int>> labeled, int count, int degree)
{
{
public class GetHostByNameTest
{
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void DnsObsoleteBeginGetHostByName_BadName_Throws()
{
IAsyncResult asyncObject = Dns.BeginGetHostByName("BadName", null, null);
Assert.Equal(IPAddress.Loopback, entry.AddressList[0]);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void DnsObsoleteBeginGetHostByName_MachineNameWithIPv4_MatchesGetHostByName()
{
IAsyncResult asyncObject = Dns.BeginGetHostByName(TestSettings.LocalHost, null, null);
}
[ActiveIssue("https://github.com/dotnet/runtime/issues/1488", TestPlatforms.OSX)]
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotArm64Process))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/27622")]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotArm64Process), nameof(PlatformDetection.IsThreadingSupported))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/27622")]
public void DnsObsoleteBeginEndGetHostByName_EmptyString_ReturnsHostName()
{
IPHostEntry entry = Dns.EndGetHostByName(Dns.BeginGetHostByName("", null, null));
{
public class GetHostEntryTest
{
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task Dns_GetHostEntryAsync_IPAddress_Ok()
{
IPAddress localIPAddress = await TestSettings.GetLocalIPAddress();
await Assert.ThrowsAsync<ArgumentException>(() => Task.Factory.FromAsync(Dns.BeginGetHostEntry, Dns.EndGetHostEntry, address.ToString(), null));
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task DnsGetHostEntry_MachineName_AllVariationsMatch()
{
IPHostEntry syncResult = Dns.GetHostEntry(TestSettings.LocalHost);
{
public class ResolveTest
{
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void DnsObsoleteBeginResolve_BadName_Throws()
{
IAsyncResult asyncObject = Dns.BeginResolve("BadName", null, null);
Assert.ThrowsAny<SocketException>(() => Dns.EndResolve(asyncObject));
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void DnsObsoleteBeginResolve_BadIPv4String_ReturnsOnlyGivenIP()
{
IAsyncResult asyncObject = Dns.BeginResolve("0.0.1.1", null, null);
Assert.Equal(IPAddress.Parse("0.0.1.1"), entry.AddressList[0]);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void DnsObsoleteBeginResolve_Loopback_MatchesResolve()
{
IAsyncResult asyncObject = Dns.BeginResolve(IPAddress.Loopback.ToString(), null, null);
Assert.Contains(pingReply.Address, localIpAddresses); ///, "Reply address {pingReply.Address} is not expected local address.");
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task SendPingAsync_InvalidArgs()
{
IPAddress localIpAddress = await TestSettings.GetLocalIPAddressAsync();
});
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(AddressFamily.InterNetwork)]
[InlineData(AddressFamily.InterNetworkV6)]
public async Task SendPingAsyncWithIPAddress(AddressFamily addressFamily)
});
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task SendPingAsyncWithIPAddress_AddressAsString()
{
IPAddress localIpAddress = await TestSettings.GetLocalIPAddressAsync();
});
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task SendPingAsyncWithIPAddressAndTimeout()
{
IPAddress localIpAddress = await TestSettings.GetLocalIPAddressAsync();
}
[PlatformSpecific(TestPlatforms.Windows)] // On Unix, Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply.
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task SendPingAsyncWithIPAddressAndTimeoutAndBuffer()
{
byte[] buffer = TestSettings.PayloadAsBytes;
}
[PlatformSpecific(TestPlatforms.AnyUnix)] // On Unix, Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply.
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task SendPingAsyncWithIPAddressAndTimeoutAndBuffer_Unix()
{
byte[] buffer = TestSettings.PayloadAsBytes;
}
[PlatformSpecific(TestPlatforms.Windows)] // On Unix, Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply.
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task SendPingAsyncWithIPAddressAndTimeoutAndBufferAndPingOptions()
{
IPAddress localIpAddress = await TestSettings.GetLocalIPAddressAsync();
}
[PlatformSpecific(TestPlatforms.AnyUnix)] // On Unix, Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply.
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(AddressFamily.InterNetwork)]
[InlineData(AddressFamily.InterNetworkV6)]
public async Task SendPingAsyncWithIPAddressAndTimeoutAndBufferAndPingOptions_Unix(AddressFamily addressFamily)
});
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task SendPingAsyncWithHost()
{
IPAddress[] localIpAddresses = await TestSettings.GetLocalIPAddressesAsync();
});
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task SendPingAsyncWithHostAndTimeout()
{
IPAddress[] localIpAddresses = await TestSettings.GetLocalIPAddressesAsync();
}
[PlatformSpecific(TestPlatforms.Windows)] // On Unix, Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply.
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task SendPingAsyncWithHostAndTimeoutAndBuffer()
{
IPAddress localIpAddress = await TestSettings.GetLocalIPAddressAsync();
}
[PlatformSpecific(TestPlatforms.AnyUnix)] // On Unix, Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply.
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task SendPingAsyncWithHostAndTimeoutAndBuffer_Unix()
{
IPAddress[] localIpAddresses = await TestSettings.GetLocalIPAddressesAsync();
}
[PlatformSpecific(TestPlatforms.Windows)] // On Unix, Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply.
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task SendPingAsyncWithHostAndTimeoutAndBufferAndPingOptions()
{
IPAddress localIpAddress = await TestSettings.GetLocalIPAddressAsync();
}
[PlatformSpecific(TestPlatforms.AnyUnix)] // On Unix, Non-root pings cannot send arbitrary data in the buffer, and do not receive it back in the PingReply.
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task SendPingAsyncWithHostAndTimeoutAndBufferAndPingOptions_Unix()
{
IPAddress[] localIpAddresses = await TestSettings.GetLocalIPAddressesAsync();
});
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task SendPings_ReuseInstance_Hostname()
{
IPAddress[] localIpAddresses = await TestSettings.GetLocalIPAddressesAsync();
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task SendAsyncs_ReuseInstance_Hostname()
{
IPAddress[] localIpAddresses = await TestSettings.GetLocalIPAddressesAsync();
p.Dispose();
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static async Task PingAsync_DisposeAfterSend_Success()
{
Ping p = new Ping();
Assert.True(FinalizingPing.WasFinalized);
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(true)]
[InlineData(false)]
public async Task SendPingAsyncWithHostAndTtlAndFragmentPingOptions(bool fragment)
});
}
- [ConditionalFact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[OuterLoop] // Depends on external host and assumption that network respects and does not change TTL
public async Task SendPingToExternalHostWithLowTtlTest()
{
Assert.True(stopWatch.ElapsedMilliseconds >= timeout);
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(0)]
[InlineData(1)]
[InlineData(50)]
public abstract Task<WebResponse> GetResponseAsync(WebRequest request);
public abstract Task<Stream> GetRequestStreamAsync(WebRequest request);
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadFile_ContainsExpectedContent()
{
string path = Path.GetTempFileName();
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task WriteFile_ContainsExpectedContent()
{
string path = Path.GetTempFileName();
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task WriteThenReadFile_WriteAccessResultsInNullResponseStream()
{
string path = Path.GetTempFileName();
protected virtual bool EnableConcurrentReadWriteTests => true;
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task RequestAfterResponse_throws()
{
string path = Path.GetTempFileName();
}
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(null)]
[InlineData(false)]
[InlineData(true)]
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public static void ReadAsyncAfterInitializationWithUriThrows()
{
using (XmlReader reader = XmlReader.Create("http://test.test/test.html", new XmlReaderSettings() { Async = true }))
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public static void ReadAfterInitializationWithUriOnAsyncReaderTrows()
{
using (XmlReader reader = XmlReader.Create("http://test.test/test.html", new XmlReaderSettings() { Async = true }))
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux), nameof(PlatformDetection.IsThreadingSupported))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsSubsystemForLinux))] // [ActiveIssue("https://github.com/dotnet/runtime/issues/18258")]
public static void InitializationWithUriOnNonAsyncReaderTrows()
{
Assert.Throws<System.Net.Http.HttpRequestException>(() => XmlReader.Create("http://test.test/test.html", new XmlReaderSettings() { Async = false }));
}
//[Variation("Multiple Transform(): Reader - Basic Test")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc1()
{
Load("xslt_multithreading_test.xsl", "foo.xml");
}
//[Variation("Multiple Transform(): Reader - QFE 505 Repro")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc2()
{
AppContext.SetSwitch("Switch.System.Xml.AllowDefaultResolver", true);
}
//[Variation("Multiple Transform(): Reader - AVTs")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc3()
{
Load("xslt_multith_AVTs.xsl", "xslt_multith_AVTs.xml");
}
//[Variation("Multiple Transform(): Reader - xsl:key")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc4()
{
Load("xslt_multith_keytest.xsl", "xslt_multith_keytest.xml");
}
//[Variation("Multiple Transform(): Reader - xsl:sort")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc5()
{
Load("xslt_multith_sorting.xsl", "xslt_multith_sorting.xml");
}
//[Variation("Multiple Transform(): Reader - Attribute Sets")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc6()
{
Load("xslt_mutith_attribute_sets.xsl", "xslt_mutith_attribute_sets.xml");
}
//[Variation("Multiple Transform(): Reader - Boolean Expression AND")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc7()
{
Load("xslt_mutith_boolean_expr_and.xsl", "xslt_mutith_boolean_expr_and.xml");
}
//[Variation("Multiple Transform(): Reader - Boolean Expression OR")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc8()
{
Load("xslt_mutith_boolean_expr_or.xsl", "xslt_mutith_boolean_expr_or.xml");
}
//[Variation("Multiple Transform(): Reader - FormatNubmer function")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc9()
{
Load("xslt_mutith_format_number.xsl", "xslt_mutith_format_number.xml");
}
//[Variation("Multiple Transform(): Reader - Position() function")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc10()
{
Load("xslt_mutith_position_func.xsl", "xslt_mutith_position_func.xml");
}
//[Variation("Multiple Transform(): Reader - preserve space")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc11()
{
Load("xslt_mutith_preserve_space.xsl", "xslt_mutith_preserve_space.xml");
}
//[Variation("Multiple Transform(): Reader - Variable nodeset")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc12()
{
Load("xslt_mutith_variable_nodeset.xsl", "xslt_mutith_variable_nodeset.xml");
}
//[Variation("Multiple Transform(): TextWriter - Basic Test")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc1()
{
Load("xslt_multithreading_test.xsl", "foo.xml");
}
//[Variation("Multiple Transform(): TextWriter - QFE 505 Repro")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc2()
{
AppContext.SetSwitch("Switch.System.Xml.AllowDefaultResolver", true);
}
//[Variation("Multiple Transform(): TextWriter - AVTs")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc3()
{
Load("xslt_multith_AVTs.xsl", "xslt_multith_AVTs.xml");
}
//[Variation("Multiple Transform(): TextWriter - xsl:key")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc4()
{
Load("xslt_multith_keytest.xsl", "xslt_multith_keytest.xml");
}
//[Variation("Multiple Transform(): TextWriter - xsl:sort")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc5()
{
Load("xslt_multith_sorting.xsl", "xslt_multith_sorting.xml");
}
//[Variation("Multiple Transform(): TextWriter - Attribute Sets")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc6()
{
Load("xslt_mutith_attribute_sets.xsl", "xslt_mutith_attribute_sets.xml");
}
//[Variation("Multiple Transform(): TextWriter - Boolean Expression AND")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc7()
{
Load("xslt_mutith_boolean_expr_and.xsl", "xslt_mutith_boolean_expr_and.xml");
}
//[Variation("Multiple Transform(): TextWriter - Boolean Expression OR")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc8()
{
Load("xslt_mutith_boolean_expr_or.xsl", "xslt_mutith_boolean_expr_or.xml");
}
//[Variation("Multiple Transform(): TextWriter - FormatNubmer function")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc9()
{
Load("xslt_mutith_format_number.xsl", "xslt_mutith_format_number.xml");
}
//[Variation("Multiple Transform(): TextWriter - Position() function")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc10()
{
Load("xslt_mutith_position_func.xsl", "xslt_mutith_position_func.xml");
}
//[Variation("Multiple Transform(): TextWriter - preserve space")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc11()
{
Load("xslt_mutith_preserve_space.xsl", "xslt_mutith_preserve_space.xml");
}
//[Variation("Multiple Transform(): TextWriter - Variable nodeset")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc12()
{
Load("xslt_mutith_variable_nodeset.xsl", "xslt_mutith_variable_nodeset.xml");
}
//[Variation("Multiple GetParam for same parameter name")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc1()
{
CThreads rThreads = new CThreads(_output);
}
//[Variation("Multiple GetParam for different parameter name")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc2()
{
CThreads rThreads = new CThreads(_output);
}
//[Variation("Multiple GetExtensionObject for same namespace System.Xml.Tests")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc1()
{
CThreads rThreads = new CThreads(_output);
}
//[Variation("Multiple GetExtensionObject for different namespace System.Xml.Tests")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc2()
{
CThreads rThreads = new CThreads(_output);
// Multiple Transform() using shared ArgumentList
////////////////////////////////////////////////////////////////
//[Variation("Multiple transforms using shared ArgumentList")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc1()
{
CThreads rThreads = new CThreads(_output);
[InlineData("xslt_mutith_variable_global_forward_ref_deep.xsl", "xslt_mutith_variable_nodeset.xml")]
//[Variation("Local and global variables", Params = new object[] { "xslt_mutith_variable_local_and_global.xsl", "xslt_mutith_variable_local_and_global.xsl" })]
[InlineData("xslt_mutith_variable_local_and_global.xsl", "xslt_mutith_variable_local_and_global.xsl")]
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void Variations(object param0, object param1)
{
string xslFile = (string)param0;
}
//[Variation("Multiple GetParam for same parameter name")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc1()
{
CThreads rThreads = new CThreads(_output);
}
//[Variation("Multiple GetParam for different parameter name")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc2()
{
CThreads rThreads = new CThreads(_output);
}
//[Variation("Multiple GetExtensionObject for same namespace System.Xml.Tests")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc1()
{
CThreads rThreads = new CThreads(_output);
}
//[Variation("Multiple GetExtensionObject for different namespace System.Xml.Tests")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc2()
{
CThreads rThreads = new CThreads(_output);
// Multiple Transform() using shared ArgumentList
////////////////////////////////////////////////////////////////
//[Variation("Multiple transforms using shared ArgumentList")]
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void proc1()
{
CThreads rThreads = new CThreads(_output);
// These are the tests to fill in some of the coverage in ported Mono caching tests
public class AdditionalCacheTests
{
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void DisposedCacheTest()
{
var mc = new MemoryCache("my disposed cache 1");
{
public class MemoryCacheTest
{
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ConstructorParameters()
{
MemoryCache mc;
});
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Defaults()
{
var mc = new MemoryCache("MyCache");
mc.DefaultCacheCapabilities);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void DefaultInstanceDefaults()
{
var mc = MemoryCache.Default;
Assert.Equal(TimeSpan.FromMinutes(70), mc.PollingInterval);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Indexer()
{
var mc = new PokerMemoryCache("MyCache");
Assert.False(mc.Contains("key"));
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void CreateCacheEntryChangeMonitor()
{
var mc = new PokerMemoryCache("MyCache");
Assert.True (monitor.HasChanged);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void AddOrGetExisting_String_Object_DateTimeOffset_String()
{
var mc = new PokerMemoryCache("MyCache");
Assert.Null(value);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void AddOrGetExisting_String_Object_CacheItemPolicy_String()
{
var mc = new PokerMemoryCache("MyCache");
Assert.Null(value);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void AddOrGetExisting_CacheItem_CacheItemPolicy()
{
var mc = new PokerMemoryCache("MyCache");
Assert.Equal("AddOrGetExisting (CacheItem item, CacheItemPolicy policy)", mc.Calls[0]);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Set_String_Object_CacheItemPolicy_String()
{
var mc = new PokerMemoryCache("MyCache");
Assert.Equal("Set (string key, object value, CacheItemPolicy policy, string regionName = null)", mc.Calls[0]);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Set_String_Object_DateTimeOffset_String()
{
var mc = new PokerMemoryCache("MyCache");
Assert.Equal("Set (string key, object value, CacheItemPolicy policy, string regionName = null)", mc.Calls[1]);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Set_CacheItem_CacheItemPolicy()
{
var mc = new PokerMemoryCache("MyCache");
Assert.Equal("Set (string key, object value, CacheItemPolicy policy, string regionName = null)", mc.Calls[1]);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Remove()
{
var mc = new PokerMemoryCache("MyCache");
Assert.False(callbackInvoked);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void GetValues()
{
var mc = new PokerMemoryCache("MyCache");
Assert.False(value.ContainsKey("Key1"));
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ChangeMonitors()
{
bool removed = false;
// Due to internal implementation details Trim has very few easily verifiable scenarios
// ActiveIssue: https://github.com/dotnet/runtime/issues/36488
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotArm64Process), nameof(PlatformDetection.IsThreadingSupported))]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotArm64Process))]
public void Trim()
{
var config = new NameValueCollection();
Assert.Equal(expect, actual);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void XmlBaseWriter_FlushAsync()
{
string actual = null;
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void Concurrent_Add_Read_Remove_DifferentObjects()
{
var cwt = new ConditionalWeakTable<object, object>();
});
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void Concurrent_GetValue_Read_Remove_DifferentObjects()
{
var cwt = new ConditionalWeakTable<object, object>();
});
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void Concurrent_GetValue_Read_Remove_SameObject()
{
object key = new object();
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public static void ConcurrentAccess()
{
const int ParallelTasks = 3;
Assert.Equal(input.Sum(b => (long)b), BitConverter.ToInt64(output, 0));
}
- [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Theory]
[InlineData(0)]
[InlineData(10)]
[InlineData(4096)]
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public async Task ComputeHashAsync_SupportsCancellation()
{
using (CancellationTokenSource cancellationSource = new CancellationTokenSource(100))
new WrappedMemoryStream(canRead: true, canWrite: false, canSeek: false, bytes)));
}
- [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Theory]
[MemberData(nameof(ReducedTestCases))]
public static void ParseJson_UnseekableStream_Async(bool compactData, TestCaseType type, string jsonString)
{
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void MultipleThreads_SameType_DifferentJson()
{
// Use local options to avoid obtaining already cached metadata from the default options.
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void MultipleThreads_DifferentTypes()
{
// Use local options to avoid obtaining already cached metadata from the default options.
// this options is not the default options instance the tests will not use previously cached metadata.
private static JsonSerializerOptions s_options = new JsonSerializerOptions();
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(WriteSuccessCases))]
public static void MultipleTypes(ITestClass testObj)
{
Task.WaitAll(tasks);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void Cannot_DeserializeAsync_ObjectWith_Ctor_With_65_Params()
{
async Task RunTest<T>()
Assert.Contains(type.ToString(), ex.ToString());
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(TypesWithInvalidMembers_WithMembers))]
public void TypeWithInvalidMember(Type classType, Type invalidMemberType, string invalidMemberName)
{
ValidateException(ex, classType, invalidMemberType, invalidMemberName);
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(OpenGenericTypes_ToSerialize))]
public void SerializeOpenGeneric(Type type)
{
Assert.Throws<ArgumentException>(() => Serializer.Serialize(obj, type));
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(OpenGenericTypes))]
public void SerializeInvalidTypes_NullValue(Type type)
{
Assert.Contains(type.ToString(), ex.ToString());
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void SerializeOpenGeneric_NullableOfT()
{
Type openNullableType = typeof(Nullable<>);
Assert.Equal(1, root.ZeroLengthProperty);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static void TestJsonPathDoesNotFailOnMultiThreads()
{
const int ThreadCount = 8;
await Assert.ThrowsAsync<ArgumentNullException>(async () => await JsonSerializer.DeserializeAsync(new MemoryStream(), (Type)null));
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static async Task ReadSimpleObjectAsync()
{
using (MemoryStream stream = new MemoryStream(SimpleTestClass.s_data))
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public static async Task ReadSimpleObjectWithTrailingTriviaAsync()
{
byte[] data = Encoding.UTF8.GetBytes(SimpleTestClass.s_json + " /* Multi\r\nLine Comment */\t");
Assert.Equal(0, result);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TryWrite_DropNewest_WrappedAroundInternalQueue()
{
var c = Channel.CreateBounded<int>(new BoundedChannelOptions(3) { FullMode = BoundedChannelFullMode.DropNewest });
Assert.Equal(0, result);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task CancelPendingWrite_Reading_DataTransferredFromCorrectWriter()
{
var c = Channel.CreateBounded<int>(1);
}
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(1)]
[InlineData(10)]
[InlineData(10000)]
}));
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(1)]
[InlineData(10)]
[InlineData(10000)]
Assert.Equal((NumItems * (NumItems + 1L)) / 2, readTotal);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task WaitToWriteAsync_AfterFullThenRead_ReturnsTrue()
{
var c = Channel.CreateBounded<int>(1);
Assert.True(await write2);
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(ThreeBools))]
public void AllowSynchronousContinuations_Reading_ContinuationsInvokedAccordingToSetting(bool allowSynchronousContinuations, bool cancelable, bool waitToReadAsync)
{
r.GetAwaiter().GetResult();
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(false)]
[InlineData(true)]
public void AllowSynchronousContinuations_CompletionTask_ContinuationsInvokedAccordingToSetting(bool allowSynchronousContinuations)
r.GetAwaiter().GetResult();
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TryWrite_NoBlockedReaders_WaitingReader_WaiterNotified()
{
Channel<int> c = CreateChannel();
Assert.Equal(TaskStatus.RanToCompletion, completion.Status);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task Complete_AfterEmpty_NoWaiters_TriggersCompletion()
{
Channel<int> c = CreateChannel();
await c.Reader.Completion;
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task Complete_AfterEmpty_WaitingReader_TriggersCompletion()
{
Channel<int> c = CreateChannel();
await Assert.ThrowsAnyAsync<InvalidOperationException>(() => r);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task Complete_BeforeEmpty_WaitingReaders_TriggersCompletion()
{
Channel<int> c = CreateChannel();
Assert.False(c.Writer.TryComplete());
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TryComplete_ErrorsPropage()
{
Channel<int> c;
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void SingleProducerConsumer_ConcurrentReadWrite_Success()
{
Channel<int> c = CreateChannel();
Assert.True(write.Result);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task WaitToWriteAsync_ManyConcurrent_SatisifedByReaders()
{
if (RequiresSingleReader || RequiresSingleWriter)
Assert.False(c.Writer.TryWrite(42));
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task WriteAsync_AfterComplete_ThrowsException()
{
Channel<int> c = CreateChannel();
await Assert.ThrowsAnyAsync<InvalidOperationException>(async () => await c.Writer.WriteAsync(42));
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task Complete_WithException_PropagatesToCompletion()
{
Channel<int> c = CreateChannel();
Assert.Same(exc, await Assert.ThrowsAsync<FormatException>(() => c.Reader.Completion));
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task Complete_WithCancellationException_PropagatesToCompletion()
{
Channel<int> c = CreateChannel();
await AssertCanceled(c.Reader.Completion, cts.Token);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task Complete_WithException_PropagatesToExistingWriter()
{
Channel<int> c = CreateFullChannel();
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task Complete_WithException_PropagatesToNewWriter()
{
Channel<int> c = CreateChannel();
Assert.Same(exc, (await Assert.ThrowsAsync<ChannelClosedException>(async () => await write)).InnerException);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task Complete_WithException_PropagatesToExistingWaitingReader()
{
Channel<int> c = CreateChannel();
await Assert.ThrowsAsync<FormatException>(async () => await read);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task Complete_WithException_PropagatesToNewWaitingReader()
{
Channel<int> c = CreateChannel();
await Assert.ThrowsAsync<FormatException>(async () => await read);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task Complete_WithException_PropagatesToNewWaitingWriter()
{
Channel<int> c = CreateChannel();
Assert.True(waitTask.IsCanceled);
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(false)]
[InlineData(true)]
public async Task WaitToReadAsync_DataWritten_CompletesSuccessfully(bool cancelable)
Assert.True(await read);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task WaitToReadAsync_NoDataWritten_Canceled_CompletesAsCanceled()
{
Channel<int> c = CreateChannel();
await Assert.ThrowsAnyAsync<OperationCanceledException>(async () => await read);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAsync_ThenWriteAsync_Succeeds()
{
Channel<int> c = CreateChannel();
Assert.Equal(42, await r);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task WriteAsync_ReadAsync_Succeeds()
{
Channel<int> c = CreateChannel();
Assert.True(readTask.IsCanceled);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAsync_Canceled_CanceledAsynchronously()
{
Channel<int> c = CreateChannel();
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAsync_WriteAsync_ManyConcurrentReaders_SerializedWriters_Success()
{
if (RequiresSingleReader)
Assert.Equal((Items * (Items - 1)) / 2, Enumerable.Sum(await Task.WhenAll(readers.Select(r => r.AsTask()))));
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAsync_TryWrite_ManyConcurrentReaders_SerializedWriters_Success()
{
if (RequiresSingleReader)
Assert.Equal((Items * (Items - 1)) / 2, Enumerable.Sum(await Task.WhenAll(readers)));
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAsync_AlreadyCompleted_Throws()
{
Channel<int> c = CreateChannel();
await Assert.ThrowsAsync<ChannelClosedException>(() => c.Reader.ReadAsync().AsTask());
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAsync_SubsequentlyCompleted_Throws()
{
Channel<int> c = CreateChannel();
await Assert.ThrowsAsync<ChannelClosedException>(() => r);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAsync_AfterFaultedChannel_Throws()
{
Channel<int> c = CreateChannel();
Assert.Same(e, cce.InnerException);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAsync_AfterCanceledChannel_Throws()
{
Channel<int> c = CreateChannel();
await Assert.ThrowsAnyAsync<OperationCanceledException>(() => c.Reader.ReadAsync().AsTask());
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAsync_Canceled_WriteAsyncCompletesNextReader()
{
Channel<int> c = CreateChannel();
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAsync_ConsecutiveReadsSucceed()
{
Channel<int> c = CreateChannel();
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task WaitToReadAsync_ConsecutiveReadsSucceed()
{
Channel<int> c = CreateChannel();
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task WaitToReadAsync_AwaitThenGetResult_Throws()
{
Channel<int> c = CreateChannel();
Assert.Throws<InvalidOperationException>(() => read.GetAwaiter().GetResult());
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAsync_AwaitThenGetResult_Throws()
{
Channel<int> c = CreateChannel();
Assert.Throws<InvalidOperationException>(() => read.GetAwaiter().GetResult());
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task WaitToWriteAsync_AwaitThenGetResult_Throws()
{
Channel<int> c = CreateFullChannel();
Assert.Throws<InvalidOperationException>(() => write.GetAwaiter().GetResult());
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task WriteAsync_AwaitThenGetResult_Throws()
{
Channel<int> c = CreateFullChannel();
from setNonDefaultTaskScheduler in new[] { true, false }
select new object[] { readOrWait, completeBeforeOnCompleted, flowExecutionContext, continueOnCapturedContext, setNonDefaultTaskScheduler };
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(Reader_ContinuesOnCurrentContextIfDesired_MemberData))]
public async Task Reader_ContinuesOnCurrentSynchronizationContextIfDesired(
bool readOrWait, bool completeBeforeOnCompleted, bool flowExecutionContext, bool? continueOnCapturedContext, bool setNonDefaultTaskScheduler)
from setDefaultSyncContext in new[] { true, false }
select new object[] { readOrWait, completeBeforeOnCompleted, flowExecutionContext, continueOnCapturedContext, setDefaultSyncContext };
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[MemberData(nameof(Reader_ContinuesOnCurrentSchedulerIfDesired_MemberData))]
public async Task Reader_ContinuesOnCurrentTaskSchedulerIfDesired(
bool readOrWait, bool completeBeforeOnCompleted, bool flowExecutionContext, bool? continueOnCapturedContext, bool setDefaultSyncContext)
Assert.NotSame(e, c.Reader.ReadAllAsync());
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(false)]
[InlineData(true)]
public async Task ReadAllAsync_UseMoveNextAsyncAfterCompleted_ReturnsFalse(bool completeWhilePending)
}
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAllAsync_UnavailableDataCompletesAsynchronously()
{
Channel<int> c = CreateChannel();
}
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(0)]
[InlineData(1)]
[InlineData(128)]
Assert.Equal(producedTotal, consumedTotal);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAllAsync_MultipleEnumerationsToEnd()
{
Channel<int> c = CreateChannel();
}
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(false)]
[InlineData(true)]
public async Task ReadAllAsync_DualConcurrentEnumeration_AllItemsEnumerated(bool sameEnumerable)
Assert.Equal(producerTotal, consumerTotal);
}
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(false)]
[InlineData(true)]
public async Task ReadAllAsync_CanceledBeforeMoveNextAsync_Throws(bool dataAvailable)
Assert.Equal(cts.Token, oce.CancellationToken);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task ReadAllAsync_CanceledAfterMoveNextAsync_Throws()
{
Channel<int> c = CreateChannel();
public void CreateBounded_ValidBufferSizes_Success(int bufferedCapacity) =>
Assert.NotNull(Channel.CreateBounded<int>(bufferedCapacity));
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task DefaultWriteAsync_UsesWaitToWriteAsyncAndTryWrite()
{
var c = new TestChannelWriter<int>(10);
Assert.False(t.IsCompleted);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task DefaultWriteAsync_CatchesTryWriteExceptions()
{
var w = new TryWriteThrowingWriter<int>();
await Assert.ThrowsAsync<FormatException>(async () => await t);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task DefaultReadAsync_CatchesTryWriteExceptions()
{
var r = new TryReadThrowingReader<int>();
await Assert.ThrowsAsync<FieldAccessException>(() => t);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TestBaseClassReadAsync()
{
WrapperChannel<int> channel = new WrapperChannel<int>(10);
await c.Reader.Completion;
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void AllowSynchronousContinuations_WaitToReadAsync_ContinuationsInvokedAccordingToSetting()
{
Channel<int> c = CreateChannel();
r.GetAwaiter().GetResult();
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public void AllowSynchronousContinuations_CompletionTask_ContinuationsInvokedAccordingToSetting()
{
Channel<int> c = CreateChannel();
{
public class BroadcastBlockTests
{
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void TestCtor()
{
var blocks = new[] {
DataflowTestHelpers.TestArgumentsExceptions<Tuple<int, int, int>>(new JoinBlock<int, int, int>());
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TestPostThenReceive()
{
const int Iters = 3;
Assert.Equal(expected: Iterations / b.BatchSize, actual: completedCount);
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task BroadcastToActions()
{
var b = new BroadcastBlock<int>(i => i);
await wob.Completion;
}
- [Fact]
+ [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
public async Task TestBroadcasting()
{
var wob = new WriteOnceBlock<int>(i => i + 1);
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public static void RunUnwrapTests_CancellationTests()
{
Task taskRoot = null;
{
private void EmptyTimerTarget(object o) { }
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Timer_Change_DueTime_OutOfRange_Throws()
{
using (var t = new Timer(new TimerCallback(EmptyTimerTarget), null, 1, 1))
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Timer_Change_Period_OutOfRange_Throws()
{
using (var t = new Timer(new TimerCallback(EmptyTimerTarget), null, 1, 1))
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Timer_Change_AfterDispose_Throws()
{
var t = new Timer(new TimerCallback(EmptyTimerTarget), null, 1, 1);
Assert.Throws<ObjectDisposedException>(() => t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1)));
}
- [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Theory]
[InlineData(0)]
[InlineData(1)]
[InlineData(2)]
AssertExtensions.Throws<ArgumentNullException>("callback", () => new Timer(null, new object(), TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1)));
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Timer_AllConstructorsCanBeUsedSuccessfully()
{
const int Timeout = 10_000;
{
public class TimerDisposeTests
{
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Dispose_NotFired_WaitHandleSignaledImmediately()
{
var t = new Timer(_ => { }, null, int.MaxValue, int.MaxValue);
Assert.True(t.DisposeAsync().IsCompletedSuccessfully);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public async Task DisposeAsync_DisposeDelayedUntilCallbacksComplete()
{
using (var b = new Barrier(2))
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public async Task DisposeAsync_MultipleDisposesBeforeCompletionReturnSameTask()
{
using (var b = new Barrier(2))
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public async Task DisposeAsync_AfterDisposeWorks()
{
using (var b = new Barrier(2))
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public async Task DisposeAsync_AfterDisposeWaitHandleThrows()
{
using (var b = new Barrier(2))
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public async Task DisposeAsync_ThenDisposeWaitHandleReturnsFalse()
{
using (var b = new Barrier(2))
{
internal const int MaxPositiveTimeoutInMs = 30000;
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Timer_Fires_After_DueTime_Ellapses()
{
AutoResetEvent are = new AutoResetEvent(false);
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Timer_Fires_AndPassesStateThroughCallback()
{
AutoResetEvent are = new AutoResetEvent(false);
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Timer_Fires_AndPassesNullStateThroughCallback()
{
AutoResetEvent are = new AutoResetEvent(false);
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Timer_FiresOnlyOnce_OnDueTime_With_InfinitePeriod()
{
int count = 0;
});
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Timer_CanDisposeSelfInCallback()
{
Timer t = null;
GC.KeepAlive(t);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Timer_CanBeDisposedMultipleTimes()
{
// There's nothing to validate besides that we don't throw an exception, so rely on xunit
t.Dispose();
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void NonRepeatingTimer_ThatHasAlreadyFired_CanChangeAndFireAgain()
{
AutoResetEvent are = new AutoResetEvent(false);
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void MultpleTimers_PeriodicTimerIsntBlockedByBlockedCallback()
{
int callbacks = 2;
GC.KeepAlive(t);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ManyTimers_EachTimerDoesFire()
{
int maxTimers = 10000;
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Timer_Constructor_CallbackOnly_Change()
{
var e = new ManualResetEvent(false);
Assert.Throws<ArgumentNullException>(() => new Timer(s => { }).Dispose(null));
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Timer_Dispose_WaitHandle()
{
int tickCount = 0;
Transaction.Current = null;
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void AsyncFail1()
{
Assert.Throws<InvalidOperationException>(() =>
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void AsyncFail2()
{
Assert.Throws<TransactionAbortedException>(() =>
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void AsyncFail3()
{
s_delayedException = null;
Assert.IsType<TransactionAbortedException>(s_delayedException);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Async1()
{
IntResourceManager irm = new IntResourceManager(1);
throw new Exception("", s_delayedException);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Async2()
{
IntResourceManager irm = new IntResourceManager(1);
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Async3()
{
IntResourceManager irm = new IntResourceManager(1);
irm.Check(1, 1, 0, 0, "irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Async4()
{
IntResourceManager irm = new IntResourceManager(1);
irm.Check(1, 1, 0, 0, "irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Async5()
{
IntResourceManager irm = new IntResourceManager(1);
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void LegacyNestedTxScope()
{
string txId1 = null;
Assert.NotEqual(txId1, txId5);
}
- [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Theory]
// Async TS nested inside Sync TS
[InlineData(TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Suppress, TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Enabled)]
[InlineData(TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Suppress, TransactionScopeOption.RequiresNew, TransactionScopeAsyncFlowOption.Enabled)]
}
}
- [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Theory]
[InlineData(TransactionScopeAsyncFlowOption.Suppress, TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Suppress, TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Enabled)]
[InlineData(TransactionScopeAsyncFlowOption.Suppress, TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Enabled, TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Suppress)]
[InlineData(TransactionScopeAsyncFlowOption.Enabled, TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Suppress, TransactionScopeOption.Required, TransactionScopeAsyncFlowOption.Enabled)]
}
}
- [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Theory]
[InlineData(TransactionScopeAsyncFlowOption.Suppress, TransactionScopeAsyncFlowOption.Enabled, TransactionScopeAsyncFlowOption.Suppress, TransactionScopeOption.Required, false)]
[InlineData(TransactionScopeAsyncFlowOption.Enabled, TransactionScopeAsyncFlowOption.Suppress, TransactionScopeAsyncFlowOption.Enabled, TransactionScopeOption.Required, false)]
[InlineData(TransactionScopeAsyncFlowOption.Suppress, TransactionScopeAsyncFlowOption.Enabled, TransactionScopeAsyncFlowOption.Suppress, TransactionScopeOption.Required, true)]
AssertTransactionNull();
}
- [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Theory]
[InlineData(TransactionScopeAsyncFlowOption.Suppress)]
[InlineData(TransactionScopeAsyncFlowOption.Enabled)]
public void VerifyBYOT(TransactionScopeAsyncFlowOption asyncFlowOption)
Transaction.Current = null;
}
- [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Theory]
[InlineData(CloneType.Normal, IsolationLevel.Serializable, false, TransactionStatus.Committed)]
[InlineData(CloneType.Normal, IsolationLevel.RepeatableRead, false, TransactionStatus.Committed)]
[InlineData(CloneType.Normal, IsolationLevel.ReadCommitted, false, TransactionStatus.Committed)]
#region Vol1_Dur0
/* Single volatile resource, SPC happens */
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol1_Dur0()
{
IntResourceManager irm = new IntResourceManager(1);
irm.CheckSPC("irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol1_Dur0_2PC()
{
IntResourceManager irm = new IntResourceManager(1);
}
/* Single volatile resource, SPC happens */
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol1_Dur0_Fail1()
{
IntResourceManager irm = new IntResourceManager(1);
irm.Check(0, 0, 0, 1, 0, 0, 0, "irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol1_Dur0_Fail2()
{
Assert.Throws<TransactionAbortedException>(() =>
});
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol1_Dur0_Fail3()
{
Assert.Throws<TransactionAbortedException>(() =>
#region Vol2_Dur0
/* >1 volatile, 2PC */
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol2_Dur0_SPC()
{
IntResourceManager irm = new IntResourceManager(1);
#region Vol0_Dur1
/* 1 durable */
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol0_Dur1()
{
IntResourceManager irm = new IntResourceManager(1);
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol0_Dur1_Fail()
{
IntResourceManager irm = new IntResourceManager(1);
#region Vol2_Dur1
/* >1vol + 1 durable */
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol2_Dur1()
{
IntResourceManager[] irm = new IntResourceManager[4];
/* >1vol + 1 durable
* Durable fails SPC
*/
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol2_Dur1_Fail1()
{
IntResourceManager[] irm = new IntResourceManager[4];
/* >1vol + 1 durable
* Volatile fails Prepare
*/
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol2_Dur1_Fail3()
{
IntResourceManager[] irm = new IntResourceManager[4];
irm[3].Check(0, 0, 0, 1, 0, 0, 0, "irm [3]");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol2_Dur1_Fail4()
{
IntResourceManager[] irm = new IntResourceManager[2];
irm[1].Check(0, 1, 0, 1, 0, 0, 0, "irm [1]");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol2_Dur1_Fail5()
{
CommittableTransaction ct = new CommittableTransaction();
#endregion
#region Promotable Single Phase Enlistment
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol0_Dur0_Pspe1()
{
IntResourceManager irm = new IntResourceManager(1);
irm.Check(1, 0, 0, 0, 0, 1, 0, "irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol1_Dur0_Pspe1()
{
IntResourceManager irm0 = new IntResourceManager(1);
irm1.Check(1, 0, 0, 0, 0, 1, 0, "irm1");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol0_Dur1_Pspe1()
{
IntResourceManager irm0 = new IntResourceManager(1);
// an enlistment failure. An exception is not thrown, but the PSPE still "failed"
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol0_Dur0_Pspe2()
{
IntResourceManager irm0 = new IntResourceManager(1);
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void TransactionDispose()
{
CommittableTransaction ct = new CommittableTransaction();
irm.Check(0, 0, 0, 0, "Dispose transaction");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void TransactionDispose2()
{
CommittableTransaction ct = new CommittableTransaction();
Assert.Equal(1, irm.Value);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void TransactionDispose3()
{
CommittableTransaction ct = new CommittableTransaction();
#endregion
#region TransactionCompleted
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void TransactionCompleted_Committed()
{
bool called = false;
Assert.True(called, "TransactionCompleted event handler not called!");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void TransactionCompleted_Rollback()
{
bool called = false;
#region Success/Failure behavior tests
#region Success/Failure behavior Vol1_Dur0 Cases
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol1SPC_Committed()
{
bool called = false;
Assert.Equal(TransactionStatus.Committed, status);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol1_Committed()
{
bool called = false;
Assert.Equal(TransactionStatus.Committed, status);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol1_Rollback()
{
bool called = false;
#endregion
#region Success/Failure behavior Vol2_Dur0 Cases
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol2SPC_Committed()
{
TransactionStatus status = TransactionStatus.Active;
Assert.Equal(TransactionStatus.Committed, status);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol2_Committed()
{
TransactionStatus status = TransactionStatus.Active;
Assert.Equal(TransactionStatus.Committed, status);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void Vol2_Rollback()
{
TransactionStatus status = TransactionStatus.Active;
Transaction.Current = null;
}
- [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Theory]
[InlineData(1, EnlistmentOptions.None, Phase1Vote.Prepared, SinglePhaseVote.Committed, true, EnlistmentOutcome.Committed, TransactionStatus.Committed)]
[InlineData(2, EnlistmentOptions.None, Phase1Vote.Prepared, SinglePhaseVote.Committed, true, EnlistmentOutcome.Committed, TransactionStatus.Committed)]
[InlineData(1, EnlistmentOptions.None, Phase1Vote.Prepared, SinglePhaseVote.Aborted, true, EnlistmentOutcome.Aborted, TransactionStatus.Aborted)]
Assert.Equal(expectedTxStatus, tx.TransactionInformation.Status);
}
- [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Theory]
// This test needs to change once we have promotion support.
// Right now any attempt to create a two phase durable enlistment will attempt to promote and will fail because promotion is not supported. This results in the transaction being
// aborted.
Assert.Equal(expectedTxStatus, tx.TransactionInformation.Status);
}
- [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Theory]
[InlineData(EnlistmentOptions.EnlistDuringPrepareRequired, Phase1Vote.Prepared, true, true, EnlistmentOutcome.Committed, TransactionStatus.Committed)]
[InlineData(EnlistmentOptions.None, Phase1Vote.Prepared, false, true, EnlistmentOutcome.Committed, TransactionStatus.Committed)]
public void EnlistDuringPhase0(EnlistmentOptions enlistmentOption, Phase1Vote phase1Vote, bool expectPhase0EnlistSuccess, bool commit, EnlistmentOutcome expectedOutcome, TransactionStatus expectedTxStatus)
/// <summary>
/// PSPE Non-MSDTC Abort From Volatile.
/// </summary>
- [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Theory]
[InlineData(false, EnlistmentOptions.EnlistDuringPrepareRequired)]
[InlineData(true, EnlistmentOptions.EnlistDuringPrepareRequired)]
[InlineData(false, EnlistmentOptions.None)]
/// <summary>
/// PSPE Non-MSDTC Completed Event.
/// </summary>
- [Theory]
+ [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
[InlineData(false)]
[InlineData(true)]
public void PSPENonMsdtcCompletedEvent(bool promote)
/// <summary>
/// Make SetDistributedTransactionIdentifier calls at the wrong time - negative test.
/// </summary>
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void PSPENonMsdtcInCorrectSetDistributedTransactionIdentifierCalls()
{
// Call SetDistributedTransactionIdentifier at the wrong time.
AssertExtensions.Throws<ArgumentOutOfRangeException>("scopeTimeout", () => new TransactionScope(TransactionScopeOption.Required, TimeSpan.FromSeconds(-1)));
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void TransactionScopeCommit()
{
Assert.Null(Transaction.Current);
Assert.Null(Transaction.Current);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void TransactionScopeAbort()
{
Assert.Null(Transaction.Current);
Assert.Null(Transaction.Current);
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void TransactionScopeCompleted1()
{
Assert.Throws<InvalidOperationException>(() =>
});
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void TransactionScopeCompleted2()
{
using (TransactionScope scope = new TransactionScope())
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void TransactionScopeCompleted3()
{
Assert.Throws<InvalidOperationException>(() =>
}
#region NestedTransactionScope tests
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void NestedTransactionScope1()
{
IntResourceManager irm = new IntResourceManager(1);
irm.Check(1, 1, 0, 0, "irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void NestedTransactionScope2()
{
IntResourceManager irm = new IntResourceManager(1);
irm.Check(0, 0, 1, 0, "irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void NestedTransactionScope3()
{
IntResourceManager irm = new IntResourceManager(1);
irm2.Check(1, 1, 0, 0, "irm2");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void NestedTransactionScope4()
{
IntResourceManager irm = new IntResourceManager(1);
irm.Check(0, 0, 1, 0, "irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void NestedTransactionScope5()
{
IntResourceManager irm = new IntResourceManager(1);
irm2.Check(0, 0, 1, 0, "irm2");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void NestedTransactionScope6()
{
IntResourceManager irm = new IntResourceManager(1);
irm.Check(1, 1, 0, 0, "irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void NestedTransactionScope7()
{
IntResourceManager irm = new IntResourceManager(1);
irm.Check(1, 1, 0, 0, "irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void NestedTransactionScope8()
{
IntResourceManager irm = new IntResourceManager(1);
irm.Check(1, 1, 0, 0, "irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void NestedTransactionScope8a()
{
IntResourceManager irm = new IntResourceManager(1);
irm.Check(0, 0, 0, 0, "irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void NestedTransactionScope9()
{
IntResourceManager irm = new IntResourceManager(1);
irm.Check(2, 2, 0, 0, "irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void NestedTransactionScope10()
{
Assert.Throws<TransactionAbortedException>(() =>
});
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void NestedTransactionScope12()
{
IntResourceManager irm = new IntResourceManager(1);
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void NestedTransactionScope13()
{
Assert.Throws<TransactionAbortedException>(() =>
/* Tests using IntResourceManager */
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void RMFail1()
{
IntResourceManager irm = new IntResourceManager(1);
#region Explicit Transaction Tests
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransactionCommit()
{
Assert.Null(Transaction.Current);
Transaction.Current = oldTransaction;
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransactionRollback()
{
Assert.Null(Transaction.Current);
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction1()
{
Assert.Null(Transaction.Current);
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction2()
{
Assert.Null(Transaction.Current);
Assert.Throws<TransactionAbortedException>(() => ct.Commit());
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction3()
{
Assert.Null(Transaction.Current);
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction4()
{
Assert.Null(Transaction.Current);
irm.Check(1, 1, 0, 0, "irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction5()
{
Assert.Null(Transaction.Current);
irm.Check(0, 0, 1, 0, "irm");
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction6()
{
Assert.Throws<InvalidOperationException>(() =>
});
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction6a()
{
Assert.Throws<InvalidOperationException>(() =>
});
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction6b()
{
CommittableTransaction ct = new CommittableTransaction();
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction6c()
{
CommittableTransaction ct = new CommittableTransaction();
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction6d()
{
CommittableTransaction ct = new CommittableTransaction();
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction6e()
{
CommittableTransaction ct = new CommittableTransaction();
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction7()
{
Assert.Throws<TransactionException>(() =>
});
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction8()
{
CommittableTransaction ct = new CommittableTransaction();
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction8a()
{
CommittableTransaction ct = new CommittableTransaction();
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction9()
{
Assert.Throws<InvalidOperationException>(() =>
});
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction10()
{
CommittableTransaction ct = new CommittableTransaction();
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction10a()
{
CommittableTransaction ct = new CommittableTransaction();
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction10b()
{
CommittableTransaction ct = new CommittableTransaction();
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction12()
{
AssertExtensions.Throws<ArgumentException>("asyncResult", () =>
});
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction13()
{
CommittableTransaction ct = new CommittableTransaction();
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction14()
{
CommittableTransaction ct = new CommittableTransaction();
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction15()
{
CommittableTransaction ct = new CommittableTransaction();
}
}
- [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]
+ [Fact]
public void ExplicitTransaction16()
{
CommittableTransaction ct = new CommittableTransaction();