CanGetProcessThreadForManagedThread() test now only runs on Windows systems; removed unused variable from expression tree cloner; removed unused variable from unit test of weak collection; fixed test issue parsing command lines relying on current platform being windows; removed unused variable from Semaphore class

git-svn-id: file:///srv/devel/repo-conversion/nusu@251 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2012-02-12 13:46:19 +00:00
parent 48e016d956
commit 61c858cb1c
5 changed files with 28 additions and 16 deletions

View File

@ -235,18 +235,19 @@ namespace Nuclex.Support {
/// be determined using the GetProcessThread() method /// be determined using the GetProcessThread() method
/// </summary> /// </summary>
[Test] [Test]
public void TestGetProcessThread() { public void CanGetProcessThreadForManagedThread() {
Thread.BeginThreadAffinity(); if(Environment.OSVersion.Platform == PlatformID.Win32NT) {
try { Thread.BeginThreadAffinity();
int threadId = AffineThreadPool.GetCurrentThreadId(); try {
int threadId = AffineThreadPool.GetCurrentThreadId();
Assert.IsNotNull(AffineThreadPool.GetProcessThread(threadId)); Assert.IsNotNull(AffineThreadPool.GetProcessThread(threadId));
Assert.IsNull(AffineThreadPool.GetProcessThread(0)); Assert.IsNull(AffineThreadPool.GetProcessThread(0));
}
finally {
Thread.EndThreadAffinity();
}
} }
finally {
Thread.EndThreadAffinity();
}
} }
/// <summary> /// <summary>

View File

@ -261,7 +261,6 @@ namespace Nuclex.Support.Cloning {
variables.Add(clone); variables.Add(clone);
int dimensionCount = clonedType.GetArrayRank(); int dimensionCount = clonedType.GetArrayRank();
int baseVariableIndex = variables.Count;
Type elementType = clonedType.GetElementType(); Type elementType = clonedType.GetElementType();
var lengths = new List<ParameterExpression>(); var lengths = new List<ParameterExpression>();

View File

@ -410,7 +410,6 @@ namespace Nuclex.Support.Collections {
Dummy oneTwoThreeDummy = new Dummy(123); Dummy oneTwoThreeDummy = new Dummy(123);
dummies.Add(oneTwoThreeDummy); dummies.Add(oneTwoThreeDummy);
Dummy fourFiveSixDummy = new Dummy(456);
Assert.Throws<ArgumentException>( Assert.Throws<ArgumentException>(
delegate() { (dummies as IList).Insert(0, new object()); } delegate() { (dummies as IList).Insert(0, new object()); }
); );

View File

@ -570,8 +570,21 @@ namespace Nuclex.Support.Parsing {
/// Tests whether the existence of named arguments can be checked /// Tests whether the existence of named arguments can be checked
/// </summary> /// </summary>
[Test] [Test]
public void TestHasArgument() { public void HasArgumentWorksForWindowsStyleArguments() {
CommandLine test = CommandLine.Parse("/first:x /second:y /second:z third"); CommandLine test = CommandLine.Parse("/first:x /second:y /second:z third", true);
Assert.IsTrue(test.HasArgument("first"));
Assert.IsTrue(test.HasArgument("second"));
Assert.IsFalse(test.HasArgument("third"));
Assert.IsFalse(test.HasArgument("fourth"));
}
/// <summary>
/// Tests whether the existence of named arguments can be checked
/// </summary>
[Test]
public void HasArgumentWorksForUnixStyleArguments() {
CommandLine test = CommandLine.Parse("--first=x --second=y --second=z third", false);
Assert.IsTrue(test.HasArgument("first")); Assert.IsTrue(test.HasArgument("first"));
Assert.IsTrue(test.HasArgument("second")); Assert.IsTrue(test.HasArgument("second"));

View File

@ -219,7 +219,7 @@ namespace Nuclex.Support {
public void Release() { public void Release() {
// Release one lock on the resource // Release one lock on the resource
int newFree = Interlocked.Increment(ref this.free); Interlocked.Increment(ref this.free);
// Wake up any threads waiting for the resource to become available // Wake up any threads waiting for the resource to become available
this.manualResetEvent.Set(); this.manualResetEvent.Set();