private static void InitServices(HttpConfiguration config) { var storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("DataStorage")); var blobClient = storageAccount.CreateCloudBlobClient(); var nodeSerializer = new NodeBlobSerializer(); var blobContainer = blobClient.GetContainerReference("nodes"); var nodeStorage = new NodeStorage(blobContainer, nodeSerializer); var graph = new Graph(); config.DependencyResolver = new DependencyResolver(nodeStorage, graph); }
public void SearchPathSuccess() { var nodes = new NodeContainer { new Node() { id = 1, adjacentNodes = new int[] {2, 3}, label = "top" }, new Node() { id = 2, adjacentNodes = new int[] {1}, label = "second" }, new Node() { id = 3, adjacentNodes = new int[] {1, 5, 4}, label = "second" }, new Node() { id = 4, adjacentNodes = new int[] {3}, label = "second" }, new Node() { id = 5, adjacentNodes = new int[] {3}, label = "blind" }, new Node() { id = 6, adjacentNodes = new int[] {4}, label = "end" }, new Node() { id = 7, adjacentNodes = new int[] {1}, label = "blind" }, }; var graphService = new Graph(); graphService.MakeAdjactedBothWay(nodes); var search = new SearchPath(nodes); var result = search.ShortestPath(1, 6); Assert.AreEqual(new int[] {6,4,3}, result); }