public void XmlEdgeList_Add_Throws() { var graph = new AdjacencyGraph <int, Edge <int> >(); var edgeList = new XmlSerializableGraph <int, Edge <int>, AdjacencyGraph <int, Edge <int> > > .XmlEdgeList(graph); // ReSharper disable once AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => edgeList.Add(null)); }
public void XmlVertexList_Add() { var graph = new AdjacencyGraph <int, Edge <int> >(); var vertexList = new XmlSerializableGraph <int, Edge <int>, AdjacencyGraph <int, Edge <int> > > .XmlVertexList(graph); CollectionAssert.IsEmpty(vertexList); vertexList.Add(1); CollectionAssert.AreEqual( new[] { 1 }, vertexList); vertexList.Add(2); CollectionAssert.AreEqual( new[] { 1, 2 }, vertexList); }
public void XmlEdgeList_Add() { var graph = new AdjacencyGraph <int, Edge <int> >(); var edgeList = new XmlSerializableGraph <int, Edge <int>, AdjacencyGraph <int, Edge <int> > > .XmlEdgeList(graph); CollectionAssert.IsEmpty(edgeList); var edge12 = new Edge <int>(1, 2); edgeList.Add(edge12); CollectionAssert.AreEqual( new[] { edge12 }, edgeList); var edge22 = new Edge <int>(2, 2); edgeList.Add(edge22); CollectionAssert.AreEqual( new[] { edge12, edge22 }, edgeList); }