本文整理汇总了C#中Iterator.Visit方法的典型用法代码示例。如果您正苦于以下问题:C# Iterator.Visit方法的具体用法?C# Iterator.Visit怎么用?C# Iterator.Visit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Iterator
的用法示例。
在下文中一共展示了Iterator.Visit方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IteratorThrowsExceptionIfNextValueIsLessThanCurrentValue
public void IteratorThrowsExceptionIfNextValueIsLessThanCurrentValue()
{
var isMatch = MockRepository.GenerateStub<Predicate<int>>();
var iterator = new Iterator<int>(0, 2, isMatch, i => i - 1);
var total = 0;
iterator.Visit(i => total += i);
}
示例2: IteratorDoesNotCheckFirstElementForMatchIfMinimumIsGreaterThanMaximum
public void IteratorDoesNotCheckFirstElementForMatchIfMinimumIsGreaterThanMaximum()
{
var isMatch = MockRepository.GenerateStub<Predicate<int>>();
var iterator = new Iterator<int>(3, 0, isMatch, i => i + 1);
var total = 0;
iterator.Visit(i => total += i);
isMatch.AssertWasNotCalled(im => im.Invoke(3));
}
示例3: IteratorDoesNotConsiderIncludingMaximumNumberInSequence
public void IteratorDoesNotConsiderIncludingMaximumNumberInSequence()
{
var isMatch = MockRepository.GenerateStub<Predicate<int>>();
var iterator = new Iterator<int>(0, 2, isMatch, i => i + 1);
var total = 0;
iterator.Visit(i => total += i);
isMatch.AssertWasNotCalled(im => im.Invoke(2));
}
示例4: IteratorChecksAllNumbersInSequenceToSeeIfTheyMatchTheCriteria
public void IteratorChecksAllNumbersInSequenceToSeeIfTheyMatchTheCriteria()
{
var isMatch = MockRepository.GenerateStub<Predicate<int>>();
var iterator = new Iterator<int>(0, 2, isMatch, i => i + 1);
var total = 0;
iterator.Visit(i => total += i);
isMatch.AssertWasCalled(im => im.Invoke(0));
isMatch.AssertWasCalled(im => im.Invoke(1));
}
示例5: IteratorUsesIncrementExpressionToAdvanceThroughTheSequence
public void IteratorUsesIncrementExpressionToAdvanceThroughTheSequence()
{
var increment = MockRepository.GenerateStub<Func<int, int>>();
increment.Stub(inc => inc.Invoke(0)).Return(1);
increment.Stub(inc => inc.Invoke(1)).Return(2);
var iterator = new Iterator<int>(0, 2, i => true, increment);
var total = 0;
iterator.Visit(i => total += i);
increment.AssertWasCalled(im => im.Invoke(0));
increment.AssertWasCalled(im => im.Invoke(1));
}