public void SetUp() { network = RouteHelperTest.GetSnakeNetwork(false, new Point(0, 0), new Point(100, 0), new Point(100, 100)); networkCoverage = new NetworkCoverage { Network = network }; networkCoverage.Locations.NextValueGenerator = new NetworkLocationNextValueGenerator(networkCoverage); networkCoverageBindingList = new NetworkCoverageBindingList(networkCoverage); }
public void SetUp() { network = RouteHelperTest.GetSnakeNetwork(false, new Point(0, 0), new Point(100, 0), new Point(100, 100)); networkCoverage = new NetworkCoverage { Network = network }; //add locations networkCoverage[new NetworkLocation(network.Branches[0], 1.0)] = 10.0; networkCoverage[new NetworkLocation(network.Branches[0], 2.0)] = 20.0; networkCoverage.Locations.NextValueGenerator = new NetworkLocationNextValueGenerator(networkCoverage); networkCoverageBindingList = new NetworkCoverageBindingList(networkCoverage); }
public void WorksWithTimeDependentNetworkCoverage() { var timeNetworkCoverage = new NetworkCoverage("timedep", true); timeNetworkCoverage.Network = network; var t1 = new DateTime(2000, 1, 1); var t2 = new DateTime(2000, 1, 2); timeNetworkCoverage[t1, new NetworkLocation(network.Branches[0], 1)] = 10.0; timeNetworkCoverage[t1, new NetworkLocation(network.Branches[1], 2)] = 20.0; timeNetworkCoverage[t2, new NetworkLocation(network.Branches[0], 1)] = 30.0; timeNetworkCoverage[t2, new NetworkLocation(network.Branches[1], 2)] = 40.0; var timeCoverageBindingList = new NetworkCoverageBindingList(timeNetworkCoverage); Assert.AreEqual(4, timeCoverageBindingList.ColumnNames.Count()); //columns shifted Assert.AreEqual("Location_Branch", timeCoverageBindingList.GetItemProperties(null)[1].Name); var newOffset = 1.5; Assert.AreNotEqual(newOffset, timeNetworkCoverage.Locations.Values[0].Chainage); timeCoverageBindingList[0][2] = newOffset; timeCoverageBindingList[0].EndEdit(); //commit changes Assert.AreEqual(newOffset, timeNetworkCoverage.Locations.Values[0].Chainage); var gridView = new DataGridView { DataSource = timeCoverageBindingList }; WindowsFormsTestHelper.ShowModal(gridView); }