Ejemplo n.º 1
0
            public void Should_Throw_If_Node_Already_Is_Present_In_Graph()
            {
                // Given
                var graph = new CakeGraph();

                graph.Add("start");

                // When
                var result = Record.Exception(() => graph.Add("start"));

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("Node has already been added to graph.", result.Message);
            }
Ejemplo n.º 2
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"));
            }
Ejemplo n.º 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"));
            }
Ejemplo n.º 4
0
            public void Should_Find_Node_In_Graph()
            {
                // Given
                var graph = new CakeGraph();

                graph.Add("start");

                // When, Then
                Assert.True(graph.Exist("start"));
            }
Ejemplo n.º 5
0
            public void Should_Add_Node_To_Graph()
            {
                // Given
                var graph = new CakeGraph();

                // When
                graph.Add("start");

                // Then
                Assert.Equal(1, graph.Nodes.Count);
            }
Ejemplo n.º 6
0
            public void Should_Throw_If_Provided_Node_Is_Null()
            {
                // Given
                var graph = new CakeGraph();

                // When
                var result = Record.Exception(() => graph.Add(null));

                // Then
                Assert.IsArgumentNullException(result, "node");
            }
Ejemplo n.º 7
0
            public void Should_Throw_If_Provided_Node_Is_Null()
            {
                // Given
                var graph = new CakeGraph();

                // When
                var exception = Record.Exception(() => graph.Add(null));

                // Then
                Assert.IsType <ArgumentNullException>(exception);
                Assert.Equal("node", ((ArgumentNullException)exception).ParamName);
            }
Ejemplo n.º 8
0
            public void Should_Add_End_Node_If_Missing_To_Node_Collection()
            {
                // Given
                var graph = new CakeGraph();

                graph.Add("start");

                // When
                graph.Connect("start", "end");

                // Then
                Assert.Equal(2, graph.Nodes.Count);
            }