示例#1
0
        public void Question_4_1_InvalidCases()
        {
            var tree = new GraphNode <int>(0, null);

            TestHelpers.AssertExceptionThrown(() => { Question_4_1.AreConnectedBFS(null, tree); }, typeof(ArgumentNullException));
            TestHelpers.AssertExceptionThrown(() => { Question_4_1.AreConnectedBFS(tree, null); }, typeof(ArgumentNullException));
        }
示例#2
0
        private void Validate <T>(GraphNode <T> node1, GraphNode <T> node2, bool expected, bool expectedBiDirectional)
            where T : IEquatable <T>
        {
            var result = Question_4_1.AreConnectedBFS(node1, node2);

            Assert.AreEqual(expected, result, "Result did not equal expected.");
            result = Question_4_1.AreConnectedBiDirectionalBFS(node1, node2);
            Assert.AreEqual(expectedBiDirectional, result, "BiDirectional result was not expected.");
        }