本文整理汇总了C#中Bag.InspectBall方法的典型用法代码示例。如果您正苦于以下问题:C# Bag.InspectBall方法的具体用法?C# Bag.InspectBall怎么用?C# Bag.InspectBall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bag
的用法示例。
在下文中一共展示了Bag.InspectBall方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
System.Console.WriteLine("Starting Tester.");
System.Console.WriteLine("Writing Hello on wall.");
Wall wall = new Wall();
wall.writeBSTROnWall("Hello");
System.Console.WriteLine("Writing Brrrrr! on wall.");
wall.writeBSTROnWall("Brrrrr!");
System.Console.WriteLine("Reading wall:");
string wallContents = "overwrite me";
wallContents = wall.readWallBSTR();
System.Console.WriteLine("Wall says: " + wallContents);
System.Console.WriteLine("Again, Wall says: '" + wall.readWallBSTR() + "'.");
System.Console.WriteLine("\n\nDoing Bag-Ball test");
//TODO What if I create it something like: IBag bag = (IBall) Factory.BagClass(); Eberhard might have said I was supposed to be doing this sort of thing that way.
Bag bag = new Bag();
Ball ball = (Ball) bag.ProvideBall(); // TODO what if I cast it as an IBall rather than Ball
long distance_rolled;
distance_rolled = ball.roll(2);
System.Console.WriteLine("Rolling ball by 2. Accumulated distance: {0} (should say 2)", distance_rolled);
if (distance_rolled != 2) {
System.Console.WriteLine("Tester.exe: Error, distance wasn't correct. Exiting.");
Environment.Exit(-1);
}
bag.InspectBall(ball);
distance_rolled = ball.roll(9);
System.Console.WriteLine("Rolling ball by 9. Accumulated distance: {0} (should say 14)", distance_rolled);
if (distance_rolled != 14) {
System.Console.WriteLine("Tester.exe: Error, distance wasn't correct. Exiting.");
Environment.Exit(-1);
}
}