本文整理汇总了C#中IFixture.CreateMany方法的典型用法代码示例。如果您正苦于以下问题:C# IFixture.CreateMany方法的具体用法?C# IFixture.CreateMany怎么用?C# IFixture.CreateMany使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFixture
的用法示例。
在下文中一共展示了IFixture.CreateMany方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewModel_ShouldReturnCorrectValue
public async Task ViewModel_ShouldReturnCorrectValue(
IFixture fixture,
TestSchedulers scheduler)
{
//arrange
const int insertionIndex = 5;
var initialList = fixture.CreateMany<int>(10).ToArray();
var addedList = fixture.CreateMany<int>(10).ToArray();
var expected = initialList.Take(insertionIndex)
.Concat(addedList.Reverse())
.Concat(initialList.Skip(insertionIndex))
.ToArray();
var notifications = scheduler.CreateColdObservable(addedList.Select((i, ii) => OnNext(Subscribed + 1 + ii, i)).ToArray());
var sut = new UpdatableObservableViewModelBuilderOptions<int, int[], int>(
_ => { },
ct => Task.FromResult(initialList),
() => notifications,
scheduler,
scheduler,
scheduler)
.UpdateAction((i, o) => () => o.Insert(insertionIndex, i))
.ToViewModel();
//act
scheduler.Start();
await sut.RefreshAsync();
scheduler.AdvanceBy(Disposed);
var actual = ((IObservableViewModel<ObservableCollection<int>>)sut).CurrentValue;
//assert
actual.ShouldAllBeEquivalentTo(expected);
}
示例2: RandomOrderIsUsedToChooseNextTest
public void RandomOrderIsUsedToChooseNextTest(int count, int randomValue, [Frozen] IRandomizer randomizer, ParadigmTestClassCommand sut, IFixture fixture)
{
Mock.Get(randomizer).Setup(x => x.Next(count)).Returns(randomValue);
var methods = fixture.CreateMany<IMethodInfo>(count).ToList();
var actual = sut.ChooseNextTest(methods);
Assert.Equal(randomValue, actual);
}