Пример #1
0
        public void InitializeQuickestPathResults_HappyDays_HasAddedRightPathObjectsToPathDictionary()
        {
            //Arrange
            Network    dummyNetwork = DummyCreator.CreateDummyNetworkOfThreeNodesWithNoConnections(); //Has nodes "A", "B", "C"
            PathFinder sut          = new PathFinder(dummyNetwork);
            string     startNode    = "A";

            //Act
            sut.InitializeQuickestPathResults(startNode);

            //Assert
            foreach (KeyValuePair <string, Path> path in sut.QuickestPathResults)
            {
                Assert.IsTrue(dummyNetwork.Nodes.ContainsKey(path.Value.Node.Name));
                Assert.IsTrue(path.Value.NodesVisited.Count == 1);
                if (path.Key == startNode)
                {
                    Assert.AreEqual(path.Value.QuickestTimeFromStart, 0);
                }
                else
                {
                    Assert.AreEqual(path.Value.QuickestTimeFromStart, double.PositiveInfinity);
                }
            }
        }
Пример #2
0
        public void CreatePathFinder_Happydays()
        {
            Network    dummyNetwork = DummyCreator.CreateDummyNetworkOfThreeNodesWithNoConnections();
            PathFinder sut          = new PathFinder(dummyNetwork);

            Assert.IsNotNull(sut);
        }
Пример #3
0
        public void InitializeQuickestPathResults_HappyDays_HasAddedThreeEntriesToPathDictionary()
        {
            //Arrange
            Network    dummyNetwork = DummyCreator.CreateDummyNetworkOfThreeNodesWithNoConnections(); //Has nodes "A", "B", "C"
            PathFinder sut          = new PathFinder(dummyNetwork);

            //Act
            sut.InitializeQuickestPathResults("A");

            //Assert
            Assert.IsTrue(sut.QuickestPathResults.Count == 3);
        }