本文整理汇总了C#中Utility.setOwner方法的典型用法代码示例。如果您正苦于以下问题:C# Utility.setOwner方法的具体用法?C# Utility.setOwner怎么用?C# Utility.setOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utility
的用法示例。
在下文中一共展示了Utility.setOwner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testLandOn
public void testLandOn()
{
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());
}