private void RunAddTests(DdpCollection<TestDdpObject> collection, DdpFilteredCollection<TestDdpObject> sortedCollection, int numberOfAdds, int minRange, int maxRange) { Random random = new Random(); for (int i = 0; i < numberOfAdds; i++) { var newValue = random.Next(minRange, maxRange); this.AddObject(collection, newValue); this.AssertCollectionSorted(sortedCollection); } }
private void RunChangeTests(DdpCollection<TestDdpObject> collection, DdpFilteredCollection<TestDdpObject> sortedCollection, int numberOfChanges, int minRange, int maxRange) { Random random = new Random(); for (int i = 0; i < numberOfChanges; i++) { var indexToChange = random.Next(0, collection.Count); var newValue = random.Next(minRange, maxRange); this.ChangeObject(collection, collection[indexToChange].Id, newValue); this.AssertCollectionSorted(sortedCollection); } }
private void AssertCollectionSorted(DdpFilteredCollection<TestDdpObject> collection) { for (int i = 0; i < collection.Count - 1; i++) { Assert.IsTrue(collection[i].integerField <= collection[i+1].integerField); } }
/// <summary> /// Initializes a new instance of the <see cref="LeaderboardViewModel"/> class. /// </summary> /// <param name="players"> /// The players. /// </param> public LeaderboardViewModel(DdpFilteredCollection<Player> players) { this.Players = players; }