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:
parent
48e016d956
commit
61c858cb1c
|
@ -235,18 +235,19 @@ namespace Nuclex.Support {
|
|||
/// be determined using the GetProcessThread() method
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestGetProcessThread() {
|
||||
Thread.BeginThreadAffinity();
|
||||
try {
|
||||
int threadId = AffineThreadPool.GetCurrentThreadId();
|
||||
public void CanGetProcessThreadForManagedThread() {
|
||||
if(Environment.OSVersion.Platform == PlatformID.Win32NT) {
|
||||
Thread.BeginThreadAffinity();
|
||||
try {
|
||||
int threadId = AffineThreadPool.GetCurrentThreadId();
|
||||
|
||||
Assert.IsNotNull(AffineThreadPool.GetProcessThread(threadId));
|
||||
Assert.IsNull(AffineThreadPool.GetProcessThread(0));
|
||||
Assert.IsNotNull(AffineThreadPool.GetProcessThread(threadId));
|
||||
Assert.IsNull(AffineThreadPool.GetProcessThread(0));
|
||||
}
|
||||
finally {
|
||||
Thread.EndThreadAffinity();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Thread.EndThreadAffinity();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -299,7 +300,7 @@ namespace Nuclex.Support {
|
|||
"Task " + index.ToString() + " was started"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// All Thread should now be active and no work items should be waiting
|
||||
Assert.AreEqual(
|
||||
createdTasks, AffineThreadPool.ActiveThreads,
|
||||
|
|
|
@ -261,7 +261,6 @@ namespace Nuclex.Support.Cloning {
|
|||
variables.Add(clone);
|
||||
|
||||
int dimensionCount = clonedType.GetArrayRank();
|
||||
int baseVariableIndex = variables.Count;
|
||||
Type elementType = clonedType.GetElementType();
|
||||
|
||||
var lengths = new List<ParameterExpression>();
|
||||
|
|
|
@ -410,7 +410,6 @@ namespace Nuclex.Support.Collections {
|
|||
Dummy oneTwoThreeDummy = new Dummy(123);
|
||||
dummies.Add(oneTwoThreeDummy);
|
||||
|
||||
Dummy fourFiveSixDummy = new Dummy(456);
|
||||
Assert.Throws<ArgumentException>(
|
||||
delegate() { (dummies as IList).Insert(0, new object()); }
|
||||
);
|
||||
|
|
|
@ -570,8 +570,21 @@ namespace Nuclex.Support.Parsing {
|
|||
/// Tests whether the existence of named arguments can be checked
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestHasArgument() {
|
||||
CommandLine test = CommandLine.Parse("/first:x /second:y /second:z third");
|
||||
public void HasArgumentWorksForWindowsStyleArguments() {
|
||||
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("second"));
|
||||
|
|
|
@ -219,7 +219,7 @@ namespace Nuclex.Support {
|
|||
public void Release() {
|
||||
|
||||
// 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
|
||||
this.manualResetEvent.Set();
|
||||
|
|
Loading…
Reference in New Issue
Block a user