コード例 #1
0
        /// <summary>
        /// Used for running tests when the process is supposed to throw and exception
        /// </summary>
        /// <param name="input">input to be processed</param>
        private void TestProcessThrowsExceptionWith(List <string> input)
        {
            RouteGraph routeGraph = new RouteGraph();

            try {
                routeGraph.Process(input);
            }
            catch (ArgumentException exc) {
                Assert.IsTrue(exc.GetType() == typeof(ArgumentException));
                return;
            }
            Assert.Fail("Test should have thrown an ArgumentException, it did not");
        }
コード例 #2
0
        /// <summary>
        /// Used for running tests on the process function
        /// </summary>
        /// <param name="input">input to be processed</param>
        /// <param name="output">graph to be validated</param>
        private void TestProcessWith(List <string> input, List <List <int> > output)
        {
            RouteGraph routeGraph = new RouteGraph();
            RouteGraph testGraph  = new RouteGraph(output, null);

            try {
                routeGraph.Process(input);
            }
            catch (Exception exc) {
                Assert.Fail(exc.Message);
            }
            Assert.IsTrue(routeGraph.Equals(testGraph));
        }