static void Main(string[] args) { Clock clock1 = new Clock(); TrackOrm trackOrm = new TrackOrm(); string track1Path = "Data/traintrack1.txt"; string track2Path = "Data/traintrack2.txt"; TrackDescription track1 = trackOrm.LoadTrack(track1Path); TrackDescription track2 = trackOrm.LoadTrack(track2Path); ITravelPlan travelPlan = new TravelPlanner() .AddTrack(track2) .SelectTrain(2) .StartAt(1, "10:00") .ArriveAt(2, "10:56") .StartAt(2, "12:17") .ArriveAt(3, "13:20") //.SelectTrain(3) //.StartAt(1, "12:30") //.ArriveAt(2, "14:46") .GeneratePlan(); travelPlan.Save(); // test to see if the trains would crash: // ITravelPlan travelPlanShouldCrash = // new TravelPlanner() // .AddTrack(track2) // .SelectTrain(2).StartAt(1, "10:00").ArriveAt(2, "12:12").SelectTrain(3).StartAt(2, "11:30").ArriveAt(1, "17:00").GeneratePlan(); }
public void LoadTrack_expect_StationConnections_NotNull() { var path = "Data/mock_track.txt"; TrackOrm trackOrm = new TrackOrm(); TrackDescription track = trackOrm.LoadTrack(path); Assert.NotNull(track.StationConnections); }
public void FindStart_Expect_0_3() { TrackOrm trackOrm = new TrackOrm(); var path = "Data/mock_track.txt"; List <string> track = FileIO.GetDataFromFile(path); Coordinate c = trackOrm.FindStart(track); Assert.Equal(0, c.LinePosition); Assert.Equal(3, c.CharacterPosition); }
public void When_ProvidingTwoStationsWithOneTrackBetween_Expect_TheTrackToConcistOf3Parts() { // Arrange string track = "[1]-[2]"; TrackOrm trackOrm = new TrackOrm(); // Act var result = trackOrm.ParseTrackDescription(track); // Assert Assert.Equal(3, result.NumberOfTrackParts); }
public void When_OnlyAStationIsProvided_Expect_TheResultOnlyToContainAStationWithId1() { // Arrange string track = "[1]"; TrackOrm trackOrm = new TrackOrm(); // Act var result = trackOrm.ParseTrackDescription(track); // Assert //Assert.IsType<Station>(result.TackPart[0]); //Station s = (Station)result.TackPart[0]; //Assert.Equal(1, s.Id); }