本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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);
}
示例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());
}
示例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);
}
示例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());
}
示例8: AddWagonNullTest
public void AddWagonNullTest()
{
Train train = new Train(1, 1);
Wagon wagon1 = null;
train.Add(wagon1);
}