public void ON_ConvertPathToEdgeData_WHEN_Path_Does_Not_Exist_SHOULD_Throw_Exception() { // Arrange var uut = new SymbolGraph <string, string>(40, StringComparer.InvariantCultureIgnoreCase); TestEdgesFactory.Define(uut, v => v.Source + v.Destination, TestEdgesFactory.DefinitionSet.PathA2J | TestEdgesFactory.DefinitionSet.JA); uut.Freeze(); // Act var _ = uut.ConvertPathToEdgeData("ADJF".AsStrings()).ToArray(); // Assert handled by expected exception. }
public void ON_ConvertPathToEdgeData_WHEN_Path_Exists_SHOULD_Return_Path_Edge_Data() { // Arrange var uut = new SymbolGraph <string, string>(40, StringComparer.InvariantCultureIgnoreCase); TestEdgesFactory.Define(uut, v => v.Source + v.Destination, TestEdgesFactory.DefinitionSet.PathA2J | TestEdgesFactory.DefinitionSet.JA); uut.Freeze(); // Act var edges = uut.ConvertPathToEdgeData("ABCD".AsStrings()).ToArray(); // Assert CollectionAssert.AreEqual(EnumerableExtensions.Enumerate("AB", "BC", "CD").ToArray(), edges.ToArray()); }
public void ON_GetPathTo_WHEN_Single_Path_Exist_SHOULD_Return_Proper_Path() { // Arrange var uut = new SymbolGraph <string, string>(40, StringComparer.InvariantCultureIgnoreCase); TestEdgesFactory.Define(uut, v => v.Source + v.Destination, TestEdgesFactory.DefinitionSet.PathA2J); uut.Freeze(); var map = uut.GetSearchMapFrom("A"); // Act var path = map.GetPathTo("J").ToArray(); // Assert CollectionAssert.AreEqual(TestEdgesFactory.VertexSymbolsA2J, path); }
public void ON_GetPathTo_WHEN_Vertex_Does_Not_Exist_SHOULD_Return_Empty() { // Arrange var uut = new SymbolGraph <string, string>(40, StringComparer.InvariantCultureIgnoreCase); TestEdgesFactory.Define(uut, v => v.Source + v.Destination, TestEdgesFactory.DefinitionSet.PathA2J); uut.Freeze(); var map = uut.GetSearchMapFrom("@"); // Act var any = map.GetPathTo("!").Any(); // Assert Assert.IsFalse(any); }
public void ON_GetPathTo_WHEN_Vertex_Self_Looped_SHOULD_Return_Buckle_Path() { // Arrange var uut = new SymbolGraph <string, string>(40, StringComparer.InvariantCultureIgnoreCase); TestEdgesFactory.Define(uut, v => v.Source + v.Destination, TestEdgesFactory.DefinitionSet.PathA2J | TestEdgesFactory.DefinitionSet.JA | TestEdgesFactory.DefinitionSet.SelfA2J); uut.Freeze(); var map = uut.GetSearchMapFrom("B"); // Act var path = map.GetPathTo("B").ToArray(); // Assert CollectionAssert.AreEqual("BB".AsStrings().ToArray(), path); }
public void ON_GetPathTo_WHEN_Multiple_Paths_SHOULD_Return_Shortest_Path() { // Arrange var uut = new SymbolGraph <string, string>(40, StringComparer.InvariantCultureIgnoreCase); TestEdgesFactory.Define(uut, v => v.Source + v.Destination, TestEdgesFactory.DefinitionSet.PathA2J | TestEdgesFactory.DefinitionSet.EMFNBIGD); uut.Freeze(); var map = uut.GetSearchMapFrom("A"); // Act var path = map.GetPathTo("J").ToArray(); // Assert CollectionAssert.AreEqual("ABIJ".AsStrings().ToArray(), path); }