Skip to content

Commit

Permalink
Merge pull request dotnet#523 from stephentoub/merge_v1
Browse files Browse the repository at this point in the history
Merge v1 to master
  • Loading branch information
nguerrera committed Jan 26, 2015
2 parents a361922 + 5cdde5b commit 74aa2bb
Show file tree
Hide file tree
Showing 152 changed files with 14,611 additions and 376 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BE8ED8C1-C314-4C4E-A929-64C9C8B3552A}</ProjectGuid>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AssemblyName>XunitTraitsDiscoverers</AssemblyName>
<RootNamespace>Xunit.TraitDiscoverers</RootNamespace>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Win32.Primitives</RootNamespace>
<AssemblyName>Microsoft.Win32.Primitives</AssemblyName>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<AssemblyName>Microsoft.Win32.Primitives.Tests</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<RootNamespace>Microsoft.Win32.Registry</RootNamespace>
<AssemblyName>Microsoft.Win32.Registry</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@ public static void InternalCancellation_CompleteAdding_Negative()

Task.Run(() => coll1.CompleteAdding());
//call Take.. it should wake up with an OCE. when CompleteAdding() is called.
Assert.Throws<InvalidOperationException>(
() => coll1.Take());
// "InternalCancellation_WakingUpTake: an IOE should be thrown if CompleteAdding occurs during blocking Take()");
Assert.Throws<InvalidOperationException>(
() => coll1.Add(1));
// "InternalCancellation_WakingUpAdd: an InvalidOpEx should be thrown if CompleteAdding occurs during blocking Add()");
Assert.Throws<InvalidOperationException>(
() => coll1.TryAdd(1, 1000000)); //an indefinite wait to add.. 1000 seconds.
// "InternalCancellation_WakingUpTryAdd: an InvalidOpEx should be thrown if CompleteAdding occurs during blocking Add()");
Assert.Throws<InvalidOperationException>(() => coll1.Take());
// "InternalCancellation_WakingUpTake: an IOE should be thrown if CompleteAdding occurs during blocking Take()");
Assert.Throws<InvalidOperationException>(() => coll1.Add(1));
// "InternalCancellation_WakingUpAdd: an InvalidOpEx should be thrown if CompleteAdding occurs during blocking Add()");
Assert.Throws<InvalidOperationException>(() => coll1.TryAdd(1, 1000000)); //an indefinite wait to add.. 1000 seconds.
// "InternalCancellation_WakingUpTryAdd: an InvalidOpEx should be thrown if CompleteAdding occurs during blocking Add()");
}

//This tests that Take/TryTake wake up correctly if CompleteAdding() is called while the taker is waiting.
Expand All @@ -43,8 +40,6 @@ public static void InternalCancellation_WakingUpTryTake()
});

int item;
Assert.False(coll1.IsAddingCompleted,
"InternalCancellation_WakingUpTryTake: At this point CompleteAdding should not have occurred.");
bool tookItem = coll1.TryTake(out item, 1000000); // wait essentially indefinitely. 1000seconds.
Assert.False(tookItem,
"InternalCancellation_WakingUpTryTake: TryTake should wake up with tookItem=false.");
Expand Down Expand Up @@ -92,9 +87,8 @@ public static void ExternalCancel_Negative()
Task.Run(() => cs.Cancel());

int item;

EnsureOperationCanceledExceptionThrown(
() => bc.Take(cs.Token), cs.Token,
() => bc.Take(cs.Token), cs.Token,
"ExternalCancel_Take: The operation should wake up via token cancellation.");
EnsureOperationCanceledExceptionThrown(
() => bc.TryTake(out item, 100000, cs.Token), cs.Token,
Expand Down Expand Up @@ -167,11 +161,11 @@ public static void ExternalCancel_GetConsumingEnumerable()
{
BlockingCollection<int> bc = new BlockingCollection<int>();
CancellationTokenSource cs = new CancellationTokenSource();
new Task(() =>
Task.Run(() =>
{
Task.WaitAll(Task.Delay(100));
cs.Cancel();
}).Start();
});

IEnumerable<int> enumerable = bc.GetConsumingEnumerable(cs.Token);

Expand Down
Loading

0 comments on commit 74aa2bb

Please sign in to comment.