Ejemplo n.º 1
0
        [Category(TestCategory.BadQuality)] // TODO: test Add or change name
        public void AddManyBranchesWithSimpleBranchFeature()
        {
            const int count     = 10000;
            int       weirCount = 0;

            Action action = delegate // TODO: what are we testing here? Test only add.
            {
                var network = new HydroNetwork();
                for (int i = 0; i < count; i++)
                {
                    var from = new HydroNode();
                    var to   = new HydroNode();

                    network.Nodes.Add(from);
                    network.Nodes.Add(to);

                    var channel = new Channel {
                        Source = from, Target = to
                    };

                    var compositeBranchStructure = new CompositeBranchStructure();
                    NetworkHelper.AddBranchFeatureToBranch(compositeBranchStructure, channel, 0);
                    HydroNetworkHelper.AddStructureToComposite(compositeBranchStructure, new Weir());

                    network.Branches.Add(channel);
                }

                foreach (IWeir weir in network.Weirs)                     // access all Weirs should be also fast
                {
                    weirCount++;
                }
            };

            TestHelper.AssertIsFasterThan(2750, string.Format("Added {0} branches with {1} weirs", count, weirCount), action);
        }
Ejemplo n.º 2
0
        public void AddManyBranchesWithCrossSections()
        {
            TestHelper.AssertIsFasterThan(2000, () =>
            {
                const int count = 10000;
                var network     = new HydroNetwork();
                for (int i = 0; i < count; i++)
                {
                    var from = new HydroNode();
                    var to   = new HydroNode();

                    network.Nodes.Add(from);
                    network.Nodes.Add(to);

                    var channel = new Channel {
                        Source = from, Target = to
                    };
                    NetworkHelper.AddBranchFeatureToBranch(channel,
                                                           new CrossSection(),
                                                           0);

                    network.Branches.Add(channel);
                }

                int crossSectionCount = 0;
                foreach (ICrossSection crossSection in network.CrossSections)
                // access all CrossSections should be also fast
                {
                    crossSectionCount++;
                }
            });
        }
Ejemplo n.º 3
0
        public void UpdateChainagesRegardlessOfOrderingAfterSplitBranch()
        {
            var network = new Network();
            var branch  = new Branch
            {
                Source         = new Node("n1"),
                Target         = new Node("n2"),
                IsLengthCustom = false,
                Length         = 1000,
                Geometry       = GeometryFromWKT.Parse("LINESTRING(0 0, 100 0)")
            };

            network.Branches.Add(branch);

            var f1 = new SimpleBranchFeature();
            var f2 = new SimpleBranchFeature();
            var f3 = new SimpleBranchFeature();
            var f4 = new SimpleBranchFeature();

            NetworkHelper.AddBranchFeatureToBranch(f1, branch, 5);
            NetworkHelper.AddBranchFeatureToBranch(f2, branch, 50);
            NetworkHelper.AddBranchFeatureToBranch(f3, branch, 15);
            NetworkHelper.AddBranchFeatureToBranch(f4, branch, 10);

            NetworkHelper.SplitBranchAtNode(network.Branches.First(), 20);

            Assert.AreEqual(5, f1.Chainage);
            Assert.AreEqual(30, f2.Chainage);
            Assert.AreEqual(15, f3.Chainage);
            Assert.AreEqual(10, f4.Chainage);
        }
Ejemplo n.º 4
0
        public void CloneHydroNetworkWithVariousBranchFeatures()
        {
            var network = new HydroNetwork();
            var from    = new HydroNode();
            var to      = new HydroNode();

            network.Nodes.Add(from);
            network.Nodes.Add(to);
            var channel = new Channel {
                Source = from, Target = to
            };

            network.Branches.Add(channel);
            var compositeBranchStructure = new CompositeBranchStructure();

            NetworkHelper.AddBranchFeatureToBranch(compositeBranchStructure, channel, 0);
            HydroNetworkHelper.AddStructureToComposite(compositeBranchStructure, new Weir());
            HydroNetworkHelper.AddStructureToComposite(compositeBranchStructure, new Pump());

            var crossSectionXYZ = new CrossSectionDefinitionXYZ
            {
                Geometry = new LineString(new[] { new Coordinate(0, 0), new Coordinate(10, 0) })
            };

            HydroNetworkHelper.AddCrossSectionDefinitionToBranch(channel, crossSectionXYZ, 0);

            var clonedHydroNetwork = (IHydroNetwork)network.Clone();

            clonedHydroNetwork.CrossSections.Should().Have.Count.EqualTo(1);
            clonedHydroNetwork.CompositeBranchStructures.Should().Have.Count.EqualTo(1);
            clonedHydroNetwork.Weirs.Should().Have.Count.EqualTo(1);
            clonedHydroNetwork.Pumps.Should().Have.Count.EqualTo(1);
        }
Ejemplo n.º 5
0
        public void SetZValueCausesPropertyChangedForXYZCrossSection()
        {
            IChannel channel = new Channel {
                Geometry = new LineString(new[] { new Coordinate(0, 0), new Coordinate(20, 0) })
            };
            var crossSection = new CrossSection {
                Branch = channel
            };

            NetworkHelper.AddBranchFeatureToBranch(channel, crossSection, 10.0);

            var yzCoordinates = new List <ICoordinate>
            {
                new Coordinate(0.0, 0.0),
                new Coordinate(100.0, 0.0),
            };

            crossSection.Geometry = CrossSectionHelper.CreateCrossSectionGeometryForXyzCrossSectionFromYZ(channel.Geometry,
                                                                                                          crossSection.Offset,
                                                                                                          yzCoordinates);

            int callCount = 0;

            ((INotifyPropertyChanged)(crossSection)).PropertyChanged += (s, e) =>
            {
                callCount++;
                Assert.AreEqual("Geometry",
                                e.PropertyName);
            };

            crossSection.SetZValue(0, 100);
            Assert.AreEqual(1, callCount);
        }
Ejemplo n.º 6
0
        public void SetDefaultGeometryWithBrancheGeometry()
        {
            const double defaultLength = 2;
            var          hydroNetwork  = new HydroNetwork();

            var channel = new Channel {
                Geometry = new LineString(new[] { new Coordinate(0, 0), new Coordinate(20, 0) })
            };

            var crossSection = new CrossSection
            {
                CrossSectionType = CrossSectionType.GeometryBased,
                Geometry         = new LineString(new[] { new Coordinate(10, 0), new Coordinate(10, 0) }),
                ThalWay          = defaultLength / 2
            };

            hydroNetwork.Branches.Add(channel);
            NetworkHelper.AddBranchFeatureToBranch(channel, crossSection, crossSection.Offset);
            crossSection.Offset = 12;

            CrossSectionHelper.SetDefaultGeometry(crossSection, defaultLength);

            Assert.AreEqual(defaultLength, crossSection.Geometry.Length);
            Assert.AreEqual(2, crossSection.Geometry.Coordinates.Length);

            Assert.AreEqual(12, crossSection.Geometry.Coordinates[0].X);
            Assert.AreEqual(12, crossSection.Geometry.Coordinates[1].X);
            Assert.AreEqual(-defaultLength / 2, crossSection.Geometry.Coordinates[0].Y);
            Assert.AreEqual(defaultLength / 2, crossSection.Geometry.Coordinates[1].Y);
        }
Ejemplo n.º 7
0
        public void MergeBranchesWithCustomLength(bool isCustomLength)
        {
            //arrange : network with 2 branches
            var network = RouteHelperTest.GetSnakeNetwork(false, 2);

            if (isCustomLength)
            {
                network.Branches.ForEach(b => b.IsLengthCustom = true);
            }

            NetworkHelper.AddBranchFeatureToBranch(new TestBranchFeature(), network.Branches[0], 10.0);
            NetworkHelper.AddBranchFeatureToBranch(new TestBranchFeature(), network.Branches[0], 60.0);
            NetworkHelper.AddBranchFeatureToBranch(new TestBranchFeature(), network.Branches[1], 30.0);
            NetworkHelper.AddBranchFeatureToBranch(new TestBranchFeature(), network.Branches[1], 90.0);

            //action! the 2nd node is the connection node...remove it
            NetworkHelper.MergeNodeBranches(network.Nodes[1], network);

            Assert.AreEqual(4, network.BranchFeatures.Count());
            var expectedChainage = new[] { 10.0, 60.0, 130.0, 190.0 };
            var index            = 0;

            foreach (var branchFeature in network.BranchFeatures)
            {
                Assert.AreEqual(network.Branches[0], branchFeature.Branch);
                Assert.AreEqual(expectedChainage[index++], branchFeature.Chainage);
            }
        }
Ejemplo n.º 8
0
        public void CloneHydroNetworkWithVariousBranchFeatures()
        {
            var network = new HydroNetwork();
            var from    = new HydroNode();
            var to      = new HydroNode();

            network.Nodes.Add(from);
            network.Nodes.Add(to);
            var channel = new Channel {
                Source = from, Target = to
            };

            network.Branches.Add(channel);
            var compositeBranchStructure = new CompositeBranchStructure();

            NetworkHelper.AddBranchFeatureToBranch(channel, compositeBranchStructure, 0);
            HydroNetworkHelper.AddStructureToComposite(compositeBranchStructure, new Weir());
            HydroNetworkHelper.AddStructureToComposite(compositeBranchStructure, new Pump());

            NetworkHelper.AddBranchFeatureToBranch(channel, new CrossSection(), 0);

            var clonedHydroNetwork = (IHydroNetwork)network.Clone();

            clonedHydroNetwork.CrossSections.Should().Have.Count.EqualTo(1);
            clonedHydroNetwork.CompositeBranchStructures.Should().Have.Count.EqualTo(1);
            clonedHydroNetwork.Weirs.Should().Have.Count.EqualTo(1);
            clonedHydroNetwork.Pumps.Should().Have.Count.EqualTo(1);
        }
Ejemplo n.º 9
0
        public void AddCrossSectionToBranch()
        {
            var branchFeature = mocks.Stub <IBranchFeature>();
            var branch        = new Branch(new Node("from"), new Node("To"));

            NetworkHelper.AddBranchFeatureToBranch(branchFeature, branch, branchFeature.Chainage);
            Assert.AreEqual(branch, branchFeature.Branch);
        }
Ejemplo n.º 10
0
        public void AddCrossSectionToBranch()
        {
            var crossSection = new CrossSection();
            var branch       = new Channel(new HydroNode("from"), new HydroNode("To"));

            NetworkHelper.AddBranchFeatureToBranch(branch, crossSection, crossSection.Offset);
            Assert.AreEqual(branch, crossSection.Branch);

            //branch.BranchFeatures.Clear();
            //Assert.IsNull(crossSection.Branch);
        }
Ejemplo n.º 11
0
        public void SplitBranchFeaturesWithLengthIntoTwoFeaturesWithBranchWithCustomLength()
        {
            // n1              f1                   n2              n1          f1_1  n3  f1_2            n2
            // O--------==================----------O       ==>     O--------=========O=========----------O
            //                  ^
            //                split

            var network = new Network();
            var node1   = new Node("n1");
            var node2   = new Node("n2");

            var branch = new Branch("Branch", node1, node2, 100)
            {
                Geometry       = GeometryFromWKT.Parse("LINESTRING(0 0, 100 0)"),
                IsLengthCustom = true,
                Length         = 200
            };

            var f1 = new SimpleBranchFeature
            {
                Name     = "f1",
                Length   = 100,
                Chainage = 50,
                Geometry = GeometryFromWKT.Parse("LINESTRING(25 0, 75 0)")
            };

            network.Nodes.AddRange(new[] { node1, node2 });
            network.Branches.Add(branch);
            NetworkHelper.AddBranchFeatureToBranch(f1, branch, 50);

            // split is geometry based --> offset 50 (geometry based) == 100 m (custom length format)
            NetworkHelper.SplitBranchAtNode(branch, 50);

            Assert.AreEqual(2, network.Branches.Count);
            Assert.AreEqual(3, network.Nodes.Count);

            var branch2 = network.Branches[1];

            Assert.AreEqual(1, branch.BranchFeatures.Count);
            Assert.AreEqual(1, branch2.BranchFeatures.Count);

            var f2 = branch2.BranchFeatures[0];

            Assert.AreEqual(50, f1.Length);
            Assert.AreEqual(50, f2.Length);
            Assert.AreEqual(25, f1.Geometry.Length);
            Assert.AreEqual(25, f2.Geometry.Length);
            Assert.AreEqual(50, f1.Chainage);
            Assert.AreEqual(0, f2.Chainage);
            Assert.AreEqual("f1_1", f1.Name);
            Assert.AreEqual("f1_2", f2.Name);
        }
Ejemplo n.º 12
0
        public void NetworkLocationsAreNotAddedToBranchFeatures()
        {
            //issue pinpoints the problem of issue 2358
            var branch = new Branch
            {
                Source   = new Node("n1"),
                Target   = new Node("n2"),
                Geometry = GeometryFromWKT.Parse("LINESTRING(219478.546875 495899.46875,219434.578125 495917.3125,219202.234375 495979,219074.015625 496013.59375,219046.5 496021.15625,218850.078125 496073.59375,218732.421875 496105.65625,218572.546875 496148.9375,218473.515625 496173.90625,218463.546875 496176.65625,218454.734375 496178.9375,218264.84375 496229.65625,218163.8125 496256.53125,218073.453125 496280.59375,217862.65625 496336.71875,217672.5 496387.3125,217487.9375 496436.4375,217293.546875 496488.1875,217103.90625 496538.65625,216945.078125 496580.9375,216748.34375 496633.3125,216581.8125 496677.65625,216380.8125 496731.15625,216205.03125 496777.9375,215978.53125 496838.21875,215819.328125 496880.59375,215646.3125 496926.65625,215563.609375 496948.6875,215502.453125 496966.28125,215501.234375 496966.625,215448 496981.40625,215216.5 497069.90625,215083.546875 497124.40625,214913.109375 497191.34375,214733.015625 497260.15625,214557.265625 497329.3125,214369.578125 497403.1875,214147.828125 497490.4375,213947.328125 497569.34375,213883.34375 497594.0625,213862.03125 497601.0625,213848.140625 497603.0625,213627.5625 497609.375,213513.796875 497612.53125,213494.71875 497614.9375,213471.40625 497621.9375,213325.015625 497681.5,213317.515625 497684.40625,213049.609375 497788.21875,212896.21875 497844.78125,212675.125 497868.21875,212426.046875 497843.375,212282.171875 497830.03125,212042.1875 497810.25,211798.59375 497791.46875,211515.140625 497766.625,211509.109375 497766.09375,211234.28125 497741.8125,211070.875 497729.75,210538.3125 497760.78125,210445.53125 497768.15625,210408.921875 497763.28125,210372.796875 497752.5625,210325.953125 497745.0625,210279.109375 497742.5625,210237.625 497753.625,210209.734375 497769.71875,210001.203125 497891.03125,209796.765625 498006.6875,209763.90625 498020.5625,209722.265625 498029.3125,209691.59375 498026.40625,209600.1875 498008.53125,209498.828125 497991.75,209441.78125 497987.15625,209390.375 497987.96875,209337.359375 497996.8125,208898.703125 498072.90625,208331.625 498166.03125,208286.40625 498172.8125)")
            };

            NetworkHelper.AddBranchFeatureToBranch(new NetworkLocation(branch, 1), branch);
            Assert.AreEqual(0, branch.BranchFeatures.Count);
        }
Ejemplo n.º 13
0
        public void SplitBranchFeaturesWithLengthIntoTwoFeaturesWhereTheFeatureWithTheLongestLengthShouldBeOrginalFeature()
        {
            // n1              f1                   n2              n1      f1_1 n3   f1_2                n2
            // O--------==================----------O       ==>     O--------====O==============----------O
            //              ^                                                     (f1_B = original feature)
            //            split

            var network = new Network();
            var node1   = new Node("n1");
            var node2   = new Node("n2");

            var branch = new Branch("Branch", node1, node2, 100)
            {
                Geometry = GeometryFromWKT.Parse("LINESTRING(0 0, 100 0)")
            };

            var f1 = new SimpleBranchFeature
            {
                Name     = "f1",
                Length   = 50,
                Geometry = GeometryFromWKT.Parse("LINESTRING(25 0, 75 0)")
            };

            network.Nodes.AddRange(new[] { node1, node2 });
            network.Branches.Add(branch);
            NetworkHelper.AddBranchFeatureToBranch(f1, branch, 25);

            NetworkHelper.SplitBranchAtNode(branch, 40);

            Assert.AreEqual(2, network.Branches.Count);
            Assert.AreEqual(3, network.Nodes.Count);

            var branch2 = network.Branches[1];

            Assert.AreEqual(1, branch.BranchFeatures.Count);
            Assert.AreEqual(1, branch2.BranchFeatures.Count);

            var feature1 = branch.BranchFeatures[0];
            var feature2 = branch2.BranchFeatures[0];

            Assert.AreEqual(15, feature1.Length);
            Assert.AreEqual(35, feature2.Length);
            Assert.AreEqual(15, feature1.Geometry.Length);
            Assert.AreEqual(35, feature2.Geometry.Length);
            Assert.AreEqual(25, feature1.Chainage);
            Assert.AreEqual(0, feature2.Chainage);
            Assert.AreEqual("f1_1", feature1.Name);
            Assert.AreEqual("f1_2", feature2.Name);

            Assert.AreEqual(f1, feature2);
        }
Ejemplo n.º 14
0
        public void BranchCrossSectionShouldRaiseCollectionChangedEvent()
        {
            var crossSection = new CrossSection();
            var branch       = new Channel(new HydroNode("from"), new HydroNode("To"));

            int count = 0;

            Post.Cast <Channel, INotifyCollectionChanged>(branch).CollectionChanged += delegate { count++; };

            NetworkHelper.AddBranchFeatureToBranch(branch, crossSection, crossSection.Offset);
            Assert.AreEqual(1, count);

            branch.BranchFeatures.Clear();
            Assert.AreEqual(2, count);
        }
Ejemplo n.º 15
0
        public void YZProfileFromTabulatedCrossSections()
        {
            var branchGeometry = new LineString(new[] { new Coordinate(111, 0), new Coordinate(11, 0) });
            var channel        = new Channel {
                Geometry = branchGeometry
            };
            var crossSection = new CrossSection {
                CrossSectionType = CrossSectionType.HeightFlowStorageWidth, Offset = 10
            };

            NetworkHelper.AddBranchFeatureToBranch(channel, crossSection, crossSection.Offset);
            crossSection.HeightFlowStorageWidthData.Add(new HeightFlowStorageWidth(-10.0, 15, 25));
            crossSection.HeightFlowStorageWidthData.Add(new HeightFlowStorageWidth(0.0, 20, 30));

            CrossSectionHelper.ConvertCrossSectionType(crossSection, CrossSectionType.YZTable);
            Assert.AreEqual(CrossSectionType.YZTable, crossSection.CrossSectionType);
            Assert.AreEqual(4, crossSection.YZValues.Count);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Creates a simple test network of 1 branch amd 2 nodes. The branch has '3' parts, in the center of
        /// the first aand last is a cross section.
        ///                 n
        ///                /
        ///               /
        ///              cs
        ///             /
        ///     -------/
        ///    /
        ///   cs
        ///  /
        /// n
        /// </summary>
        /// <returns></returns>
        private static IHydroNetwork CreateTestNetwork()
        {
            var network = new Hydro.HydroNetwork();
            var branch1 = new Channel
            {
                Geometry = new LineString(new[]
                {
                    new Coordinate(0, 0), new Coordinate(30, 40),
                    new Coordinate(70, 40), new Coordinate(100, 100)
                })
            };

            var node1 = new HydroNode {
                Network = network, Geometry = new Point(new Coordinate(0, 0))
            };
            var node2 = new HydroNode {
                Network = network, Geometry = new Point(new Coordinate(100, 100))
            };

            network.Branches.Add(branch1);
            network.Nodes.Add(node1);
            network.Nodes.Add(node2);

            var crossSection1 = new CrossSection {
                Geometry = new LineString(new[] { new Coordinate(15, 20), new Coordinate(15, 20) })
            };
            double offset1 = Math.Sqrt(15 * 15 + 20 * 20);

            crossSection1.Offset = offset1;

            var crossSection2 = new CrossSection {
                Geometry = new LineString(new[] { new Coordinate(85, 70), new Coordinate(85, 70) })
            };
            double offset2 = Math.Sqrt(30 * 30 + 40 * 40) + 40 + Math.Sqrt(15 * 15 + 20 * 20);

            crossSection2.Offset = offset2;

            branch1.Source = node1;
            branch1.Target = node2;
            NetworkHelper.AddBranchFeatureToBranch(branch1, crossSection1, crossSection1.Offset);
            NetworkHelper.AddBranchFeatureToBranch(branch1, crossSection2, crossSection2.Offset);

            return(network);
        }
Ejemplo n.º 17
0
        public void CloneHydroNetworkWithCrossSection()
        {
            var network = new HydroNetwork();
            var from    = new HydroNode();
            var to      = new HydroNode();

            network.Nodes.Add(from);
            network.Nodes.Add(to);
            var channel = new Channel {
                Source = from, Target = to
            };

            network.Branches.Add(channel);
            NetworkHelper.AddBranchFeatureToBranch(channel, new CrossSection(), 0);

            var clonedHydroNetwork = (IHydroNetwork)network.Clone();

            clonedHydroNetwork.CrossSections.Should().Have.Count.EqualTo(1);
        }
Ejemplo n.º 18
0
        public void AddManyBranchesWithSimpleBranchFeature()
        {
            DateTime t = DateTime.Now;

            const int count   = 10000;
            var       network = new HydroNetwork();

            for (int i = 0; i < count; i++)
            {
                var from = new HydroNode();
                var to   = new HydroNode();

                network.Nodes.Add(from);
                network.Nodes.Add(to);

                var channel = new Channel {
                    Source = from, Target = to
                };

                var compositeBranchStructure = new CompositeBranchStructure();
                NetworkHelper.AddBranchFeatureToBranch(channel, compositeBranchStructure, 0);
                HydroNetworkHelper.AddStructureToComposite(compositeBranchStructure, new Weir());

                network.Branches.Add(channel);
            }

            int weirCount = 0;

            foreach (IWeir weir in network.Weirs) // access all Weirs should be also fast
            {
                weirCount++;
            }

            TimeSpan dt = DateTime.Now - t;

            log.InfoFormat("Added {0} branches with {1} weirs in {2} sec", count, weirCount, dt.TotalSeconds);

            // 20091029 set to 5 seconds; original test only added weirs and created an invalid hydronetwork
            Assert.LessOrEqual(dt.TotalSeconds, 2.7);
        }
Ejemplo n.º 19
0
        public void GeometryToYzToGeometryOrThereAndBackAgain()
        {
            var branchGeometry = new LineString(new[] { new Coordinate(111, 0), new Coordinate(11, 0) });
            var channel        = new Channel {
                Geometry = branchGeometry
            };
            IList <ICoordinate> yzCoordinates = new List <ICoordinate>
            {
                // note: x, y of coordinate are interpreted as the yz for
                // the cross section.
                new Coordinate(0.0, 0.0),
                new Coordinate(5.0, -20.0),
                new Coordinate(15.0, -20.0),
                new Coordinate(20.0, 0.0)
            };
            IGeometry geometry = CrossSectionHelper.CreateCrossSectionGeometryForXyzCrossSectionFromYZ(branchGeometry,
                                                                                                       30, yzCoordinates);
            CrossSection crossSection = new CrossSection {
                Geometry = geometry, Offset = 10
            };

            NetworkHelper.AddBranchFeatureToBranch(channel, crossSection, crossSection.Offset);
            Assert.AreEqual(CrossSectionType.GeometryBased, crossSection.CrossSectionType);
            const int coordinateCount = 4;

            Assert.AreEqual(coordinateCount, crossSection.Geometry.Coordinates.Length);
            Assert.AreEqual(coordinateCount, crossSection.YZValues.Count);

            CrossSectionHelper.ConvertCrossSectionType(crossSection, CrossSectionType.YZTable);
            Assert.AreEqual(coordinateCount, crossSection.YZValues.Count);
            Assert.AreEqual(2, crossSection.Geometry.Coordinates.Length);
            Assert.AreEqual(4, crossSection.YZValues.Count);
            CrossSectionHelper.ConvertCrossSectionType(crossSection, CrossSectionType.GeometryBased);
            Assert.AreEqual(CrossSectionType.GeometryBased, crossSection.CrossSectionType);
            Assert.AreEqual(coordinateCount, crossSection.Geometry.Coordinates.Length);
        }
Ejemplo n.º 20
0
        public void GetRouteChainageCustomLength()
        {
            var network = CreateThreeNodesNetwork();

            network.Branches[0].IsLengthCustom = true;
            network.Branches[0].Length        *= 2;
            network.Branches[1].IsLengthCustom = true;
            network.Branches[1].Length        *= 3;

            var networkLocation = new NetworkLocation(network.Branches[1], 30);

            NetworkHelper.AddBranchFeatureToBranch(networkLocation, network.Branches[1], 30);

            var route = new Route
            {
                Network = network,
            };

            //route going back to branch 0
            route.Locations.Values.Add(new NetworkLocation(network.Branches[0], 5.0));
            route.Locations.Values.Add(new NetworkLocation(network.Branches[1], 60.0));
            route.Locations.Values.Add(new NetworkLocation(network.Branches[1], 110.0));
            Assert.AreEqual(225.0, RouteHelper.GetRouteChainage(route, networkLocation));
        }