示例#1
0
        public void PopulateOriginalQueueStandard_OnlyFinalQueueConstructor_Matches()
        {
            int[]         final = { 5, 4, 3, 2, 1 };
            NewYearsChaos _finalQueueOnlyConstr = new NewYearsChaos(final);

            int[] ExpectedArray = { 1, 2, 3, 4, 5 };
            Assert.AreEqual(ExpectedArray, _finalQueueOnlyConstr.OriginalQueue);
        }
示例#2
0
        public void IsValid_BothValidArrays_ReturnTrue()
        {
            int[]         orig          = { 1, 2, 3, 4, 5 };
            int[]         final         = { 5, 4, 3, 2, 1 };
            NewYearsChaos _genericSetup = new NewYearsChaos(orig, final);

            Assert.IsTrue(_genericSetup.IsValid);
        }
示例#3
0
        public void CalculateBribesGeneric_Chaotic_Matches(int[] orig, int[] final, bool isChaotic, int bribeCount)
        {
            NewYearsChaos _genericConstr = new NewYearsChaos(orig, final);

            string Expected = $"{(isChaotic ? "Too Chaotic " : "")}Total Bribes: {bribeCount}";
            string Output   = _genericConstr.CalculateBribesOptimized();

            Assert.AreEqual(Expected, Output);
        }
示例#4
0
        public void CalculateBribesGeneric_NotChaotic_Return3()
        {
            int[]         orig           = { 1, 2, 3, 4, 5 };
            int[]         final          = { 2, 1, 5, 3, 4 };
            NewYearsChaos _genericConstr = new NewYearsChaos(orig, final);

            string Expected = "Total Bribes: 3";
            string Output   = _genericConstr.CalculateBribesGeneric();

            Assert.AreEqual(Expected, Output);
        }
示例#5
0
        public void IsValid_NewFinalLongerArray_ReturnTrue()
        {
            int[]         orig          = { 1, 2, 3, 4, 5 };
            int[]         final         = { 5, 4, 3, 2, 1 };
            NewYearsChaos _genericSetup = new NewYearsChaos(orig, final);

            _genericSetup.FinalQueue = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };


            Assert.IsTrue(_genericSetup.IsValid);
        }
示例#6
0
        public void PopulateOriginalQueueStandard_NewFinalQueueLonger_Matches()
        {
            int[]         orig           = { 1, 2, 3, 4, 5 };
            int[]         final          = { 5, 4, 3, 2, 1 };
            NewYearsChaos _genericConstr = new NewYearsChaos(orig, final);

            _genericConstr.FinalQueue = new int[] { 7, 6, 5, 4, 3, 2, 1 };

            // Expected
            int[] ExpectedArray = new int[] { 1, 2, 3, 4, 5, 6, 7 };

            // Assert
            Assert.AreEqual(ExpectedArray, _genericConstr.OriginalQueue);
        }