public void ShouldMaintainStateCorrectlyWhileLooping() { // Arrange var numbers = new List <int> { 1, 2, 3, 4, 5 }; var doSomethingUseful = new DoSomethingUsefulDataBuilder().Build(); var sut = CreateSut(doSomethingUseful); // Act sut.Execute(numbers); // Assert doSomethingUseful.Received().Execute(1); doSomethingUseful.Received().Execute(3); doSomethingUseful.Received().Execute(6); doSomethingUseful.Received().Execute(10); doSomethingUseful.Received().Execute(15); }
public void ShouldAlwaysDoSomethingUsefulBasedOnTheNumberOfGivenItems(int count) { // Arrange var doSomethingUseful = new DoSomethingUsefulDataBuilder().Build(); var give = 10; var sut = CreateSut(doSomethingUseful); // Act var result = sut.Execute(give).Take(count); // Assert doSomethingUseful.Received(give).Execute(Arg.Any <int>()); }
public void ShouldDoSomethingUsefulBasedOnNumberOfRequestedItems(int count, int [] expected) { // Arrange var doSomethingUseful = new DoSomethingUsefulDataBuilder().Build(); var give = 10; var sut = CreateSut(doSomethingUseful); // Act var result = sut.ExecuteWithYield(give).Take(count); // Assert result.Should().BeEquivalentTo(expected); doSomethingUseful.Received(count).Execute(Arg.Any <int>()); }