Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
 private void AssertCollectionSorted(DdpFilteredCollection<TestDdpObject> collection)
 {
     for (int i = 0; i < collection.Count - 1; i++)
     {
         Assert.IsTrue(collection[i].integerField <= collection[i+1].integerField);
     }
 }
Beispiel #4
0
 /// <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;
 }