本文整理汇总了C#中Generator.SetRandomGenerator方法的典型用法代码示例。如果您正苦于以下问题:C# Generator.SetRandomGenerator方法的具体用法?C# Generator.SetRandomGenerator怎么用?C# Generator.SetRandomGenerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Generator
的用法示例。
在下文中一共展示了Generator.SetRandomGenerator方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
randomNumberGenerator = new Mock<RandomNumberGenerator>(3);
int index = 0;
randomNumberGenerator.Setup(o => o.Next()).Returns(() => index).Callback(() => index++);
generator = new Generator();
generator.SetRandomGenerator(randomNumberGenerator.Object);
}
示例2: should_support_remove_operation
public void should_support_remove_operation()
{
generator = new Generator();
generator.SetRandomGenerator(new RandomNumberGenerator(1));
generator.AddPerson("A");
Assert.AreEqual(1, generator.Attendance());
generator.RemovePerson("A");
Assert.AreEqual(0, generator.Attendance());
generator.RemovePerson("A");
}
示例3: presenter_and_lunchorder_can_not_be_same_one
public void presenter_and_lunchorder_can_not_be_same_one()
{
var randomIndex = new[] {0, 0, 1};
randomNumberGenerator = new Mock<RandomNumberGenerator>(randomIndex.Length);
int index = 0;
randomNumberGenerator.Setup(o => o.Next()).Returns(() => randomIndex[index]).Callback(() => index++);
generator = new Generator();
generator.SetRandomGenerator(randomNumberGenerator.Object);
generator.AddPerson("A");
generator.AddPerson("B");
generator.AddPerson("C");
generator.Run();
Assert.AreEqual("A",generator.Presenter);
Assert.AreEqual("B",generator.LunchOrder);
}