本文整理汇总了C#中Schedule.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# Schedule.Copy方法的具体用法?C# Schedule.Copy怎么用?C# Schedule.Copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schedule
的用法示例。
在下文中一共展示了Schedule.Copy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Copy_Schedule
public void Copy_Schedule()
{
// Arange
int scheduleId = 1;
string scheduleName = "ScheduleName1";
int pierId = 1;
string pierName = "PierName1";
Pier pier = new Pier { Id = pierId, Name = pierName };
int routeId = 1;
string routeCode = "RouteCode1";
string routeName = "RouteName1";
Route route = new Route { Id = routeId, Code = routeCode, Name = routeName };
TimeSpan time = new TimeSpan(0, 10, 0);
Schedule oldSchedule = new Schedule { Id = scheduleId, Name = scheduleName, Pier = pier, Route = route, Time = time };
// Act
Schedule newSchedule = oldSchedule.Copy();
// Assert
Assert.AreNotSame(newSchedule, oldSchedule); // Not the same object
// Check properties
Assert.AreEqual(newSchedule.Id, scheduleId);
Assert.AreEqual(newSchedule.Name, scheduleName);
Assert.AreEqual(newSchedule.Route, route);
Assert.AreEqual(newSchedule.Pier, pier);
Assert.AreEqual(newSchedule.Time, time);
}