Esempio n. 1
0
        public void Stations_WithNonStraightSegment_ComputesCorrectStations(List <StationSegment> AlignmentSegments,
                                                                            List <StationSegment> ProfileSegments,
                                                                            List <double> ExpectedStationList,
                                                                            string Info)
        {
            Alignment.GetSegments().Returns(AlignmentSegments);
            Profile.GetSegments().Returns(ProfileSegments);
            StationComputer testcomputer = new StationComputer(Alignment, Profile);

            var ActualStationList = testcomputer.Stations;

            output.WriteLine(Info);
            Assert.Equal(ExpectedStationList, ActualStationList);
        }
Esempio n. 2
0
        public void OnCreation_ValidSegments_ComputesCorrectIndizes(List <StationSegment> AlignmentSegments,
                                                                    List <StationSegment> ProfileSegments,
                                                                    int ExpectedAlignmentIndex,
                                                                    int ExpectedProfileIndex)
        {
            Alignment.GetSegments().Returns(AlignmentSegments);
            Profile.GetSegments().Returns(ProfileSegments);
            StationComputer testcomputer = new StationComputer(Alignment, Profile);

            int ActualAlignmentIndex = testcomputer.AlignmentSegmentIndex;
            int ActualProfileIndex   = testcomputer.ProfileSegmentIndex;

            Assert.Equal(ExpectedAlignmentIndex, ActualAlignmentIndex);
            Assert.Equal(ExpectedProfileIndex, ActualProfileIndex);
        }
Esempio n. 3
0
        public void OnCreation_InvalidSegments_ThrowsArgumentException(List <StationSegment> AlignmentSegments,
                                                                       List <StationSegment> ProfileSegments,
                                                                       string Info)
        {
            Alignment.GetSegments().Returns(AlignmentSegments);
            Profile.GetSegments().Returns(ProfileSegments);
            StationComputer testcomputer;

            ArgumentException ex =
                Assert.Throws <ArgumentException>(() =>
                                                  testcomputer = new StationComputer(Alignment, Profile));

            output.WriteLine(Info);
            output.WriteLine($"Exception Message: {ex.Message}");
        }
Esempio n. 4
0
        public void Stations_CustomStartEndStationAndIncrement_ComputesCorrectStations(List <StationSegment> AlignmentSegments,
                                                                                       List <StationSegment> ProfileSegments,
                                                                                       double startStation,
                                                                                       double endStation,
                                                                                       double increment,
                                                                                       List <double> ExpectedStationList)
        {
            Alignment.GetSegments().Returns(AlignmentSegments);
            Profile.GetSegments().Returns(ProfileSegments);
            StationComputer testcomputer = new StationComputer(Alignment, Profile);

            testcomputer.StartStation = startStation;
            testcomputer.EndStation   = endStation;
            testcomputer.MaxIncrement = increment;

            var ActualStationList = testcomputer.Stations;
            var comparer          = new TolerantDoubleEqualityComparer(0.000000001);

            Assert.Equal(ExpectedStationList, ActualStationList, comparer);
        }
Esempio n. 5
0
 public PolyFitter(IAlignment alignment, IProfile profile, IPolyline polyline)
 {
     (_alignment, _profile, _polyline) = (alignment, profile, polyline);
     _computer = new StationComputer(_alignment, _profile);
 }