当前位置: 首页>>代码示例>>C#>>正文


C# Train.Add方法代码示例

本文整理汇总了C#中Train.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Train.Add方法的具体用法?C# Train.Add怎么用?C# Train.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Train的用法示例。


在下文中一共展示了Train.Add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WhenSecondTimetableCallIsAfterLastThenThrows

 public void WhenSecondTimetableCallIsAfterLastThenThrows() {
     var station = TestDataFactory.CreateStation1();
     var target = new Train(TrainCategory.Freight, "G1234");
     var call1 = new StationCall(station.Tracks.First(), new Time(12, 30), new Time(12, 45));
     var call2 = new StationCall(station.Tracks.First(), new Time(12, 50), new Time(12, 55));
     target.Add(call1);
     target.Add(call2);
 }
开发者ID:fjallemark,项目名称:TrainDispatch,代码行数:8,代码来源:TrainTests.cs

示例2: CreateTrain2

 public static Train CreateTrain2() {
     var stations = Stations.ToArray();
     var train = new Train(TrainCategory.Passenger, "P4321");
     var startTime = new Time(12, 00);
     train.Add(new StationCall(stations[2]["2"], startTime, startTime.Add(30)));
     train.Add(new StationCall(stations[1]["1"], startTime.Add(45), startTime.Add(51)));
     train.Add(new StationCall(stations[0]["3"], startTime.Add(70), startTime.Add(180)));
     return train;
 }
开发者ID:fjallemark,项目名称:TrainDispatch,代码行数:9,代码来源:TestDataFactory.cs

示例3: CreateTrain1

 public static Train CreateTrain1() {
     var stations = Stations.ToArray();
     var train = new Train(TrainCategory.Freight, "G1234");
     var startTime = new Time(12, 00);
     train.Add(new StationCall(stations[0]["3"], startTime, startTime.Add(30)));
     train.Add(new StationCall(stations[1]["2"], startTime.Add(50), startTime.Add(57)));
     train.Add(new StationCall(stations[2]["1"], startTime.Add(70), startTime.Add(180)));
     return train;
 }
开发者ID:fjallemark,项目名称:TrainDispatch,代码行数:9,代码来源:TestDataFactory.cs

示例4: CalculateStandingSpotsTest

 public void CalculateStandingSpotsTest()
 {
     Train train = new Train(1, 1);
     Wagon wagon1 = new Wagon(1, 25, 10);
     Wagon wagon2 = new Wagon(2, 15, 4);
     train.Add(wagon1);
     train.Add(wagon2);
     Assert.AreEqual(14, train.TotalStandingSpots);
 }
开发者ID:grasmanek94,项目名称:t22-4,代码行数:9,代码来源:Train_Test.cs

示例5: ToStringWithMultipleWagonsTest

 public void ToStringWithMultipleWagonsTest()
 {
     Train train = new Train(1, 1);
     Wagon wagon1 = new Wagon(1, 1, 1);
     Wagon wagon2 = new Wagon(2, 1, 1);
     Wagon wagon3 = new Wagon(3, 1, 1);
     Wagon wagon4 = new Wagon(4, 1, 1);
     train.Add(wagon1);
     train.Add(wagon2);
     train.Add(wagon3);
     train.Add(wagon4);
     Assert.AreEqual("1 - 2 - 3 - 4", train.ToString());
 }
开发者ID:grasmanek94,项目名称:t22-4,代码行数:13,代码来源:Train_Test.cs

示例6: AddsFirstTimetableCall

        [TestMethod] public void AddsFirstTimetableCall() {
            var station = TestDataFactory.CreateStation1();
            var target = new Train(TrainCategory.Freight, "G1234");
            var call = new StationCall(station.Tracks.First(), new Time(12,30) , new Time(12,45));
            target.Add(call);

        }
开发者ID:fjallemark,项目名称:TrainDispatch,代码行数:7,代码来源:TrainTests.cs

示例7: ToStringWithOneWagonTest

 public void ToStringWithOneWagonTest()
 {
     Train train = new Train(1, 1);
     Wagon wagon = new Wagon(1, 1, 1);
     train.Add(wagon);
     Assert.AreEqual("1", train.ToString());
 }
开发者ID:grasmanek94,项目名称:t22-4,代码行数:7,代码来源:Train_Test.cs

示例8: AddWagonNullTest

 public void AddWagonNullTest()
 {
     Train train = new Train(1, 1);
     Wagon wagon1 = null;
     train.Add(wagon1);
 }
开发者ID:grasmanek94,项目名称:t22-4,代码行数:6,代码来源:Train_Test.cs


注:本文中的Train.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。