public void GetTimeSeriesForCoverageOnLocation() { var network = CreateNetwork(); //set up a coverage on one location for three moments INetworkCoverage networkCoverage = new NetworkCoverage { Network = network, IsTimeDependent = true }; var networkLocation = new NetworkLocation(network.Branches[0], 0); for (var i = 1; i < 4; i++) { networkCoverage[new DateTime(2000, 1, i), networkLocation] = i; } //filter the function for the networkLocation IFunction filteredCoverage = networkCoverage.GetTimeSeries(networkLocation); Assert.AreEqual(3, filteredCoverage.Components[0].Values.Count); Assert.AreEqual(1, filteredCoverage.Arguments.Count); Assert.AreEqual(filteredCoverage.Arguments[0].Values, networkCoverage.Time.Values); }
[Test] //TOOLS-6471 public void GetTimeSeriesForEmptyCoverage() { var network = CreateNetwork(); //set up a coverage on one location for three moments INetworkCoverage networkCoverage = new NetworkCoverage { Network = network, IsTimeDependent = true }; networkCoverage.Locations.AddValues(new[] { new NetworkLocation(network.Branches[0], 0), new NetworkLocation(network.Branches[0], 100), new NetworkLocation(network.Branches[1], 0), new NetworkLocation(network.Branches[1], 200) }); var networkLocation = networkCoverage.Locations.Values[0]; //filter the function for the networkLocation var timeseries = networkCoverage.GetTimeSeries(networkLocation); Assert.IsNull(timeseries); }
public void GetTimeSeriesForCoverageOnCoordinate() { var network = CreateNetwork(); //set up a coverage on one location for three moments INetworkCoverage networkCoverage = new NetworkCoverage { Network = network, IsTimeDependent = true }; var networkLocation = new NetworkLocation(network.Branches[0], 0); for (int i = 1; i < 4; i++) { networkCoverage[new DateTime(2000, 1, i), networkLocation] = (double)i; } //filter the function for the networkLocation IFunction filteredCoverage = networkCoverage.GetTimeSeries(networkLocation.Geometry.Coordinate); Assert.AreEqual(3, filteredCoverage.Components[0].Values.Count); Assert.AreEqual(1, filteredCoverage.Arguments.Count); Assert.AreEqual(filteredCoverage.Arguments[0].Values, networkCoverage.Time.Values); }
public void GetTimeSeriesForCoverageOnNearestLocationUsingBranchFeature() { var network = CreateNetwork(); INetworkCoverage networkCoverage = new NetworkCoverage { Network = network, IsTimeDependent = true }; // set values for (var i = 1; i < 4; i++) { networkCoverage[new DateTime(2000, 1, i), new NetworkLocation(network.Branches[0], 0)] = (double)i; networkCoverage[new DateTime(2000, 1, i), new NetworkLocation(network.Branches[0], 50)] = (double)i; } // create branch feature var branchFeature = mocks.Stub<IBranchFeature>(); branchFeature.Geometry = new Point(0, 25); branchFeature.Branch = network.Branches[0]; branchFeature.Chainage = 25; // get time series var timeSeries = networkCoverage.GetTimeSeries(branchFeature); Assert.AreEqual(3, timeSeries.Components[0].Values.Count); Assert.AreEqual(1, timeSeries.Arguments.Count); Assert.AreEqual(timeSeries.Arguments[0].Values, networkCoverage.Time.Values); }