コード例 #1
0
        public void GetLocationsForAnotherRoute()
        {
            var network = CreateThreeNodesNetwork();
            var branch  = (Branch)network.Branches[0];

            var source = new NetworkCoverage {
                Network = network
            };

            source[new NetworkLocation(branch, 10.0)] = 10.0;
            source[new NetworkLocation(branch, 50.0)] = 30.0;
            source[new NetworkLocation(branch, 60.0)] = 20.0;
            source[new NetworkLocation(branch, 80.0)] = 10.0;

            //90-->0-->80
            var route = RouteHelper.CreateRoute(new[] { new NetworkLocation(branch, 90.0)
                                                        , new NetworkLocation(branch, 0.0), new NetworkLocation(branch, 80) });
            var expectedLocations = new[]
            {
                new NetworkLocation(branch, 90.0)
                , new NetworkLocation(branch, 80.0)
                , new NetworkLocation(branch, 60.0)
                , new NetworkLocation(branch, 50.0)
                , new NetworkLocation(branch, 10.0)
                , new NetworkLocation(branch, 0)
                , new NetworkLocation(branch, 10.0)
                , new NetworkLocation(branch, 50.0)
                , new NetworkLocation(branch, 60.0)
                , new NetworkLocation(branch, 80.0)
            };

            var actualLocations = RouteHelper.GetLocationsInRoute(source, route);

            Assert.AreEqual(expectedLocations, actualLocations);
        }