Example #1
0
        public void IsValidPeople_Valid()
        {
            CrossTheBridgeHelper helper = new CrossTheBridgeHelper();
            List<int> people = new List<int>() { 10, 5, 2, 1 };

            Assert.IsTrue(helper.IsValid(people));
        }
Example #2
0
        public void IsDone_Not()
        {
            CrossTheBridgeHelper helper = new CrossTheBridgeHelper();
            var APart = new int[] { 0, 0, 0, 1 };

            Assert.IsFalse(helper.IsDone(APart));
        }
Example #3
0
        public void IsDone_Done()
        {
            CrossTheBridgeHelper helper = new CrossTheBridgeHelper();
            var APart = new int[] { 0, 0, 0, 0 };

            Assert.IsTrue(helper.IsDone(APart));
        }
Example #4
0
        public void GetSmallestNumberIndex_2()
        {
            CrossTheBridgeHelper helper = new CrossTheBridgeHelper();
            List<int> people = new List<int>() { 10, 5, 2, 0 };

            Assert.AreEqual(helper.GetSmallestNumberIndex(people.ToArray()), 2);
        }
Example #5
0
        public void SendLargestPair()
        {
            CrossTheBridgeHelper helper = new CrossTheBridgeHelper();
            var APart = new List<int>() { 10, 5, 2, 1 }.ToArray();
            var BPart = new int[] { 0, 0, 0, 0 };

            int result = helper.SendLargestPair(ref APart, ref BPart);
            CollectionAssert.AreEqual(APart, new int[] { 0, 0, 2, 1 });
            CollectionAssert.AreEqual(BPart, new int[] { 10, 5, 0, 0 });
            Assert.AreEqual(result, 10);
        }
Example #6
0
        public void SortPeople()
        {
            CrossTheBridgeHelper helper = new CrossTheBridgeHelper();
            List<int> people = new List<int>() { 1, 2, 5, 10 };

            var sortedPeople = helper.Sort(people);

            CollectionAssert.AreEqual(sortedPeople, new List<int> { 10, 5, 2, 1 });
        }