Skip to content

Commit 8db135c

Browse files
committed
CLR test fixes
1 parent 49e06fc commit 8db135c

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/System.Collections.NonGeneric/tests/DictionaryBaseTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,8 @@ public static void SyncRoot()
295295
// SyncRoot should be the reference to the underlying dictionary, not to MyDictionary
296296
var dictBase = new MyDictionary();
297297
object syncRoot = dictBase.SyncRoot;
298-
Assert.NotEqual(syncRoot, dictBase);
299-
Assert.Equal(dictBase.SyncRoot, dictBase.SyncRoot);
298+
Assert.NotSame(syncRoot, dictBase);
299+
Assert.Same(dictBase.SyncRoot, dictBase.SyncRoot);
300300
}
301301

302302
[Fact]

src/System.Collections.NonGeneric/tests/HashtableTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,16 +1207,16 @@ public void SyncRoot()
12071207
var hash1 = new Hashtable();
12081208
var hash2 = new Hashtable();
12091209

1210-
Assert.NotEqual(hash1.SyncRoot, hash2.SyncRoot);
1211-
Assert.Equal(hash1.SyncRoot.GetType(), typeof(object));
1210+
Assert.NotSame(hash1.SyncRoot, hash2.SyncRoot);
1211+
Assert.Equal(hash1.SyncRoot.GetType(), typeof(Hashtable));
12121212

12131213
// Cloned hashtables have different SyncRoots
12141214
hash1 = new Hashtable();
12151215
hash2 = Hashtable.Synchronized(hash1);
12161216
Hashtable hash3 = (Hashtable)hash2.Clone();
12171217

1218-
Assert.NotEqual(hash2.SyncRoot, hash3.SyncRoot);
1219-
Assert.NotEqual(hash1.SyncRoot, hash3.SyncRoot);
1218+
Assert.NotSame(hash2.SyncRoot, hash3.SyncRoot);
1219+
Assert.NotSame(hash1.SyncRoot, hash3.SyncRoot);
12201220

12211221
// Testing SyncRoot is not as simple as its implementation looks like. This is the working
12221222
// scenario we have in mind.
@@ -1236,11 +1236,11 @@ public void SyncRoot()
12361236
_hashGrandDaughter = Hashtable.Synchronized(hashSon);
12371237
_hashDaughter = Hashtable.Synchronized(hashMother);
12381238

1239+
Assert.Same(hashSon.SyncRoot, hashMother.SyncRoot);
12391240
Assert.Equal(hashSon.SyncRoot, hashMother.SyncRoot);
1240-
Assert.Equal(hashSon.SyncRoot, hashMother.SyncRoot);
1241-
Assert.Equal(_hashGrandDaughter.SyncRoot, hashMother.SyncRoot);
1242-
Assert.Equal(_hashDaughter.SyncRoot, hashMother.SyncRoot);
1243-
Assert.Equal(hashSon.SyncRoot, hashMother.SyncRoot);
1241+
Assert.Same(_hashGrandDaughter.SyncRoot, hashMother.SyncRoot);
1242+
Assert.Same(_hashDaughter.SyncRoot, hashMother.SyncRoot);
1243+
Assert.Same(hashSon.SyncRoot, hashMother.SyncRoot);
12441244

12451245
// We are going to rumble with the Hashtables with some threads
12461246
int iNumberOfWorkers = 30;

src/System.Collections.Specialized/tests/StringDictionary/StringDictionary.SyncRootTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void SyncRoot(int count)
1717
StringDictionary stringDictionary2 = Helpers.CreateStringDictionary(count);
1818

1919
Assert.Same(stringDictionary1.SyncRoot, stringDictionary1.SyncRoot);
20-
Assert.IsType<object>(stringDictionary1.SyncRoot);
20+
Assert.IsType<Hashtable>(stringDictionary1.SyncRoot);
2121

2222
Assert.NotSame(stringDictionary1.SyncRoot, stringDictionary2.SyncRoot);
2323
}

0 commit comments

Comments
 (0)