public void AddCollide() { //**************************************** var MySeed = Environment.TickCount; var MyRandom = new Random(MySeed); var MyRecords = new ObservableSortedList <CollideStruct, int>(); var MyDictionary = new Dictionary <CollideStruct, int>(64); //**************************************** for (var Index = 0; Index < 64; Index++) { CollideStruct Key; int Value; do { Key = new CollideStruct(MyRandom.Next()); } while (MyDictionary.ContainsKey(Key)); Value = MyRandom.Next(); MyDictionary.Add(Key, Value); MyRecords.Add(Key, Value); } //**************************************** Assert.AreEqual(64, MyRecords.Count, "Count incorrect. Bad Seed was {0}", MySeed); CollectionAssert.AreEquivalent(MyDictionary, MyRecords, "Collections don't match. Bad Seed was {0}", MySeed); Thread.Sleep(1); }
public void SetKeyCollide() { //**************************************** var MyRecords = new ObservableSortedList <CollideStruct, int>(); var MyKey = new CollideStruct(10); //**************************************** MyRecords[new CollideStruct(9)] = 1; MyRecords[new CollideStruct(12)] = 2; MyRecords[new CollideStruct(10)] = 3; MyRecords[new CollideStruct(11)] = 4; MyRecords[MyKey] = 84; //**************************************** Assert.AreEqual(84, MyRecords[MyKey]); }
public void ReplaceCollide() { //**************************************** var MyRecords = new ObservableSortedList <CollideStruct, int>(); var MyKey = new CollideStruct(10); //**************************************** MyRecords.Add(new CollideStruct(9), 1); MyRecords.Add(new CollideStruct(12), 2); MyRecords.Add(new CollideStruct(10), 3); MyRecords.Add(new CollideStruct(11), 4); MyRecords[MyKey] = 84; //**************************************** Assert.AreEqual(84, MyRecords[MyKey]); }