Beispiel #1
0
 public void TestStopperTrain3()
 {
     List <string> intermediates = new List <string> {
         "Peterborough", "Newcastle"
     };
     StopperTrain stopper = new StopperTrain("A134", "Edinburgh (Waverley)", "London (Kings Cross)", false,
                                             new TimeSpan(22, 0, 0), DateTime.Parse("2018-01-01"), intermediates);
 }
Beispiel #2
0
        public void TestStopperTrain()
        {
            StopperTrain stopper = new StopperTrain("A134", "Edinburgh (Waverley)", "London (Kings Cross)", false,
                                                    new TimeSpan(22, 0, 0), DateTime.Parse("2018-01-01"), new List <string> {
            });

            Assert.AreEqual(false, stopper.SleeperBerth);
        }
Beispiel #3
0
        public void TestStopperTrain5()
        {
            List <string> intermediates = new List <string> {
                "Peterborough", "Newcastle"
            };
            StopperTrain stopper = new StopperTrain("A134", "Edinburgh (Waverley)", "London (Kings Cross)", false,
                                                    new TimeSpan(22, 0, 0), DateTime.Parse("2018-01-01"), intermediates);

            Assert.AreEqual(true, stopper.AddIntermediate("Darlington"));
        }
Beispiel #4
0
        public void TestStopperTrain2()
        {
            List <string> intermediates = new List <string> {
                "Fake", "Fake 2", "Fake 3"
            };

            try
            {
                StopperTrain stopper = new StopperTrain("A134", "Edinburgh (Waverley)", "London (Kings Cross)", false,
                                                        new TimeSpan(22, 0, 0), DateTime.Parse("2018-01-01"), intermediates);
            }
            catch (Exception e)
            {
                StringAssert.Contains(e.Message, "Intermediates are not valid.");
                return;
            }
            throw new Exception();
        }
Beispiel #5
0
        public void TestBookingCabin2()
        {
            StopperTrain example2 = new StopperTrain("SL3P", "Edinburgh (Waverley)", "London (Kings Cross)", true,
                                                     new TimeSpan(22, 0, 0), DateTime.Parse("2018-01-01"),
                                                     new List <string> {
                "Peterborough", "Darlington"
            });

            booking.TrainObj = example2;
            try
            {
                booking.Cabin = true;
            }
            catch (Exception e)
            {
                StringAssert.Contains(e.Message, "Booking cannot have cabin because train doesn't offer it.");
                return;
            }
            throw new Exception();
        }