示例#1
0
            public void Should_Not_Find_Non_Existing_Node_In_Graph()
            {
                // Given
                var graph = new CakeGraph();

                graph.Add("start");

                // When, Then
                Assert.False(graph.Exist("other"));
            }
示例#2
0
            public void Should_Find_Node_In_Graph()
            {
                // Given
                var graph = new CakeGraph();

                graph.Add("start");

                // When, Then
                Assert.True(graph.Exist("start"));
            }
示例#3
0
            public void Should_Find_Node_In_Graph_Regardless_Of_Casing()
            {
                // Given
                var graph = new CakeGraph();

                graph.Add("start");

                // When, Then
                Assert.True(graph.Exist("START"));
            }
示例#4
0
        /// <summary>
        /// Throws an <see cref="CakeException"/> if the specified node doesn't exist.
        /// </summary>
        /// <param name="target">The target node.</param>
        /// <param name="graph">The node graph.</param>
        /// <exception cref="CakeException">An exception of this type is thrown if the node isn't found.</exception>
        protected static void ThrowIfTargetNotFound(string target, CakeGraph graph)
        {
            if (graph.Exist(target))
            {
                return;
            }

            const string format = "The target '{0}' was not found.";

            throw new CakeException(string.Format(CultureInfo.InvariantCulture, format, target));
        }