Ejemplo n.º 1
0
        public void ReadFileTest()
        {
            var caveSys = new CaveSystem("allConnected.txt");

            Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
            // or Trace.Listeners.Add(new ConsoleTraceListener());
            Trace.WriteLine("Hello World");

            //CollectionAssert.AreEqual(caveSys.GetConnectedArray(1), new int[] { 25, 26, 2, 7, 6, 30 });
            //CollectionAssert.AreEqual(caveSys.GetConnectedArray(2), new int[] { 26, 3, 9, 8, 7, 1 });
            StreamWriter debug = new StreamWriter("readInValues.txt");

            for (int i = 1; i <= 30; i++)
            {
                int[] ThisArray = caveSys.GetAdjacentArray(i);
                debug.WriteLine("Cave Num: " + i.ToString() + String.Join(",", ThisArray));


                switch (i)
                {
                case 1:
                    CollectionAssert.AreEqual(ThisArray, new int[] { 25, 26, 2, 7, 6, 30 });
                    break;

                case 2:
                    CollectionAssert.AreEqual(ThisArray, new int[] { 26, 3, 9, 8, 7, 1 });
                    break;

                case 3:
                    CollectionAssert.AreEqual(ThisArray, new int[] { 27, 28, 4, 9, 2, 26 });
                    break;

                default:
                    break;
                }
            }

            debug.Close();
        }
Ejemplo n.º 2
0
        public void ReadFileTest()
        {
            var caveSys = new CaveSystem("allConnected.txt");

            //CollectionAssert.AreEqual(caveSys.GetConnectedArray(1), new int[] { 25, 26, 2, 7, 6, 30 });
            //CollectionAssert.AreEqual(caveSys.GetConnectedArray(2), new int[] { 26, 3, 9, 8, 7, 1 });
            StreamWriter debug = new StreamWriter("readInValues.txt");

            for (int i = 1; i <= 30; i++)
            {
                int[] ThisArray = caveSys.GetAdjacentArray(i);
                debug.WriteLine("Cave Num: " + i.ToString() + String.Join(",", ThisArray));


                switch (i)
                {
                case 1:
                    CollectionAssert.AreEqual(ThisArray, new int[] { 25, 26, 2, 7, 6, 30 });
                    break;

                case 2:
                    CollectionAssert.AreEqual(ThisArray, new int[] { 26, 3, 9, 8, 7, 1 });
                    break;

                case 3:
                    CollectionAssert.AreEqual(ThisArray, new int[] { 27, 28, 4, 9, 2, 26 });
                    break;

                default:
                    break;
                }
            }

            //removing duplicates and making connections double sided
            debug.Close();
        }