本文整理汇总了C#中Utility.LandOn方法的典型用法代码示例。如果您正苦于以下问题:C# Utility.LandOn方法的具体用法?C# Utility.LandOn怎么用?C# Utility.LandOn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utility
的用法示例。
在下文中一共展示了Utility.LandOn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: landing_on_a_property
public void landing_on_a_property()
{
Utility util = new Utility();
//Create two players
Player p1 = new Player("Bill");
Player p2 = new Player("Fred", 1500);
string msg;
//test landon normally with no rent payable
msg = util.LandOn(ref p1);
Console.WriteLine(msg);
//set owner to p1
util.SetOwner(ref p1);
//move p2 so that utility rent can be calculated
p2.Move();
//p2 lands on util and should pay rent
msg = util.LandOn(ref p2);
Console.WriteLine(msg);
//check that correct rent has been paid
decimal balance = 1500 - (6 * p2.GetLastMove());
Assert.AreEqual(balance, p2.GetBalance());
}