本文整理汇总了C#中CustomExtensions.UnitTests.Customization.Fixtures.BaseFixture.CreateMany方法的典型用法代码示例。如果您正苦于以下问题:C# BaseFixture.CreateMany方法的具体用法?C# BaseFixture.CreateMany怎么用?C# BaseFixture.CreateMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomExtensions.UnitTests.Customization.Fixtures.BaseFixture
的用法示例。
在下文中一共展示了BaseFixture.CreateMany方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsEmpty_OnNonGenericEnumerableMultipleItem_ReturnsFalse
public void IsEmpty_OnNonGenericEnumerableMultipleItem_ReturnsFalse()
{
var fixture = new BaseFixture();
var mock = new Mock<IEnumerable>();
mock.Setup(m => m.GetEnumerator()).Returns(fixture.CreateMany<object>().GetEnumerator);
IEnumerable sequence = mock.Object;
Assert.That(() => sequence.IsEmpty(), Is.False);
}
示例2: RandomElement_OnNonCollectionSequence_EventuallyChoosesEachItem
public void RandomElement_OnNonCollectionSequence_EventuallyChoosesEachItem()
{
var fixture = new BaseFixture(10);
IEnumerable<object> checkList = fixture.CreateMany<object>().ToArray().Select(o => o);
var dic = checkList.ToDictionary(i => i, e => 0);
var random = fixture.Create<Random>();
var maxIterations = 1000 * checkList.Count();
var iterations = 0;
while (dic.ContainsValue(0))
{
dic[checkList.RandomElement(random)]++;
var i = iterations++;
Assert.That(() => i, Is.LessThan(maxIterations), string.Format("Dictionary contains {0} items", dic.Values.Sum()));
}
}