public void Filter_Given_10Engineers_When_ShiftWasntSelectedToday_Return_AllGivenEngineers() { //arrange var engineers = new SupportEngineerMocksBuilder() .WihtEngineersWhoDidntHadTwoShiftInLastTwoWeeks(10) .Build(); var sut = new ShiftSelectedTodayFilter(); //act var result = sut.Filter(engineers); //assert result.Count().ShouldBe(engineers.Count()); }
public void Filter_Given_10Engineers_When_ShiftWasntSelectedToday_Then_CallSuccessor() { //arrange var engineers = new SupportEngineerMocksBuilder() .WihtEngineersWhoDidntHadTwoShiftInLastTwoWeeks(10) .Build(); var successor = A.Fake <ISupportEngineersFilterChain>(); var sut = new ShiftSelectedTodayFilter(successor); //act var result = sut.Filter(engineers); //assert A.CallTo(() => successor.Filter(A <IEnumerable <ISupportEngineer> > ._)) .MustHaveHappened(Repeated.Exactly.Once); }
Filter_Given_MoreThanTwoEngineersAndSuccessor_When_ShiftWasAlreadySelectedToday_SuccessorIsNotCalled() { //arrange var engineers = new SupportEngineerMocksBuilder() .WithEngineersWhoDidntHadShiftYesterday(8) .WithEngineersAlreadySelectedForToday(2) .Build(); var successor = A.Fake <ISupportEngineersFilterChain>(); var sut = new ShiftSelectedTodayFilter(successor); //act var result = sut.Filter(engineers); //assert A.CallTo(() => successor.Filter(A <IEnumerable <ISupportEngineer> > ._)) .MustNotHaveHappened(); }
Filter_Given_MoreThanTwoEngineersAndSuccessor_When_ShiftWasAlreadySelectedToday_Return_AlreadySelectedEngineers() { //arrange var engineers = new SupportEngineerMocksBuilder() .WithEngineersWhoDidntHadShiftYesterday(8) .WithEngineersAlreadySelectedForToday(2) .Build(); var successor = A.Fake <ISupportEngineersFilterChain>(); var sut = new ShiftSelectedTodayFilter(successor); //act var result = sut.Filter(engineers); //assert result.First().Name .ShouldBe(nameof(SupportEngineerMocksBuilder.WithEngineersAlreadySelectedForToday)); result.Last().Name .ShouldBe(nameof(SupportEngineerMocksBuilder.WithEngineersAlreadySelectedForToday)); }