public void TestGetValueAsc()
        {
            // Arrange
            SortingService service = new SortingService();

            int expectedLowestKey = 22;
            int actualLowestKey = -1;

            int expectedLowestTotal = 29;
            int actualLowestTotal = -1;

            int expectedHighestKey = 0;
            int actualHighestKey = -1;

            int expectedHighestTotal = 52;
            int actualHighestTotal = -1;

            // Act
            List<KeyTotal> keyTotals = service.GetValueAsc(RandomNumbers());

            KeyTotal lowestKeyTotal = keyTotals[0];
            actualLowestKey = lowestKeyTotal.Key;
            actualLowestTotal = lowestKeyTotal.Total;

            KeyTotal highestKeyTotal = keyTotals[keyTotals.Count - 1];
            actualHighestKey = highestKeyTotal.Key;
            actualHighestTotal = highestKeyTotal.Total;

            // Assert
            Assert.AreEqual(expectedLowestKey, actualLowestKey);
            Assert.AreEqual(expectedLowestTotal, actualLowestTotal);

            Assert.AreEqual(expectedHighestKey, actualHighestKey);
            Assert.AreEqual(expectedHighestTotal, actualHighestTotal);
        }
예제 #2
0
 //initialize the number of keys
 void Start()
 {
     instance = this;
     keysHeld = 0;
 }