示例#1
0
        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());
        }
示例#2
0
        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);
        }
示例#3
0
        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();
        }
示例#4
0
        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));
        }