public void AddVertex_WhenNewVertexId_ThenCreatedVertex() { // given int newVertexId = 13; string property = "qwerty"; // when Vertex <int> result = testObject.AddVertex(newVertexId, property); // then result.Id.Should().Be(newVertexId); testObject.VerticesCount.Should().Be(11); testObject.GetNeighbours(result).Should().BeEmpty(); testObject.Properties[result].Should().Be(property); }
/// <summary>Adds new vertex with given property to given group in this graph.</summary> /// <param name="groupNumber">Group number</param> /// <param name="vertex">New vertex</param> /// <param name="property">Vertex property</param> /// <returns>New vertex</returns> /// <exception cref="ArgumentException">If vertex already exists</exception> public Vertex <TVertexId> AddVertex(int groupNumber, Vertex <TVertexId> vertex, TVertexProperty property = default) { validateGroup(groupNumber); Vertex <TVertexId> newVertex = graph.AddVertex(vertex, property); vertexGroupDict[newVertex] = groupNumber; return(newVertex); }