Esempio n. 1
0
        public void GetCount_SmallDataSet_Pass()
        {
            var unsortedCollection = new Collection <int>()
            {
                1, 3, 5, 2, 4, 6
            };
            var counter       = new InversionCounterUsingDivideConquerImpl();
            var expectedCount = 3;

            //Act
            var countActual = counter.GetCount(unsortedCollection);

            //Assert
            Assert.AreEqual(expectedCount, countActual);
        }
Esempio n. 2
0
        public void GetCount_LargerDataSet_Pass()
        {
            //Arrange
            var fileLocation = @"..\..\TestData\IntegerArray.txt";

            if (!File.Exists(fileLocation))
            {
                Assert.Fail("File not found");
            }

            var lines = File.ReadAllLines(fileLocation);
            var unsortedCollection = lines.Select(line => Convert.ToInt32(line)).ToList();

            var counter       = new InversionCounterUsingDivideConquerImpl();
            var expectedCount = 2407905288;

            //Act
            var countActual = counter.GetCount(unsortedCollection);

            //Assert
            Assert.AreEqual(expectedCount, countActual);
        }