Parameters
- item
Library/Library.Test/TestSetList.cs
C# | Copy Code |
---|---|
MyValue one = new MyValue(1); MyValue two = new MyValue(2); SetList<MyValue> set = new SetList<MyValue>(); set.Add(one); set.Add(two); Assert.IsTrue(Object.ReferenceEquals(one, set[0])); Assert.IsTrue(set.Replace(new MyValue(1))); Assert.IsFalse(Object.ReferenceEquals(one, set[0])); Assert.AreEqual(2, set.Count); Assert.IsFalse(set.Replace(new MyValue(3))); //not replaced, then added Assert.AreEqual(3, set.Count); |
VB.NET | Copy Code |
---|---|
Dim one As New MyValue(1) Dim two As New MyValue(2) Dim [set] As New SetList(Of MyValue)() [set].Add(one) [set].Add(two) Assert.IsTrue([Object].ReferenceEquals(one, [set](0))) Assert.IsTrue([set].Replace(New MyValue(1))) Assert.IsFalse([Object].ReferenceEquals(one, [set](0))) Assert.AreEqual(2, [set].Count) Assert.IsFalse([set].Replace(New MyValue(3))) 'not replaced, then added Assert.AreEqual(3, [set].Count) |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7