Exemplo n.º 1
0
        public void HadShiftYesterday_When_EngineerDidntHadShiftYesterday_Returns_False()
        {
            //arrange
            var sut = new SupportEngineerBuilder()
                      .Build();

            //act
            var result = sut.HadShiftYesterday();

            //assert
            result.ShouldBeFalse();
        }
Exemplo n.º 2
0
        public void LogTodaysShift_AddTodaysDateToShiftLog()
        {
            //arrange
            var sut = new SupportEngineerBuilder()
                      .Build();

            //act
            sut.LogTodaysShift();

            //assert
            sut.ShiftCount.ShouldBe(1);
        }
Exemplo n.º 3
0
        public void DidntHadShiftInLastFiveDays_Given_HeDidntHadAnyShift_Return_True()
        {
            //arrange
            var sut = new SupportEngineerBuilder()
                      .Build();

            //act
            var result = sut.DidntHadShiftInLastWeek();

            //assert
            result.ShouldBeTrue();
        }
Exemplo n.º 4
0
        public void HaveShiftToday_When_HeDidntHadeAnyShiftsAtAll_Returns_False()
        {
            //arrange
            var sut = new SupportEngineerBuilder()
                      .Build();

            //act
            var result = sut.HaveShiftToday();

            //assert
            result.ShouldBeFalse();
        }
Exemplo n.º 5
0
        public void DidntHadShiftYesterday_When_EngieneerDidHadShiftYesterday_Returns_False()
        {
            //arrange
            var sut = new SupportEngineerBuilder()
                      .WithShiftLoggedOnDate(DateTime.Today.AddDays(-1))
                      .Build();

            //act
            var result = sut.DidntHadShiftYesterday();

            //assert
            result.ShouldBeFalse();
        }
Exemplo n.º 6
0
        public void DidntHadShiftInLastFiveDays_Given_HeHad_Return_False()
        {
            //arrange
            var sut = new SupportEngineerBuilder()
                      .WithShiftLoggedOnDate(DateTime.Today.AddDays(-7))
                      .Build();

            //act
            var result = sut.DidntHadShiftInLastWeek();

            //assert
            result.ShouldBeFalse();
        }
Exemplo n.º 7
0
        public void HaveShiftToday_When_HeHaveShiftToday_Returns_True()
        {
            //arrange
            var sut = new SupportEngineerBuilder()
                      .WithShiftLoggedOnDate(DateTime.Today)
                      .Build();

            //act
            var result = sut.HaveShiftToday();

            //assert
            result.ShouldBeTrue();
        }
Exemplo n.º 8
0
        public void HadTwoShiftsInLastTwoWeeks_When_InFactHeDid_Return_True(DateTime someDate, DateTime someOtherDate)
        {
            //arrange
            var sut = new SupportEngineerBuilder()
                      .WithShiftLoggedOnDate(someDate)
                      .WithShiftLoggedOnDate(someOtherDate)
                      .Build();

            //act
            var result = sut.HadTwoShiftsInLastTwoWeeks();

            //assert
            result.ShouldBeTrue();
        }
Exemplo n.º 9
0
        public void SelectTodaysBauShift_Given_16Engineers_Returns_TwoEngineers()
        {
            //arrange
            var engineer1WhoDidnHadShiftYesterday = new SupportEngineerBuilder()
                                                    .WithShiftLoggedOnDate(DateTime.Today.AddDays(-2))
                                                    .Build();

            var engineer2WhoDidnHadShiftYesterday = new SupportEngineerBuilder()
                                                    .WithShiftLoggedOnDate(DateTime.Today.AddDays(-2))
                                                    .Build();

            var engineerWhoHadShiftYesterday = new SupportEngineerBuilder()
                                               .WithShiftLoggedOnDate(DateTime.Today.AddDays(-1))
                                               .Build();

            var engineerWhoHadTwoShiftsInLastTwoWeeks = new SupportEngineerBuilder()
                                                        .WithShiftLoggedOnDate(DateTime.Today.AddDays(-3))
                                                        .WithShiftLoggedOnDate(DateTime.Today.AddDays(-12))
                                                        .Build();

            var engineer2WhoHadTwoShiftsInLastTwoWeeks = new SupportEngineerBuilder()
                                                         .WithShiftLoggedOnDate(DateTime.Today.AddDays(-5))
                                                         .WithShiftLoggedOnDate(DateTime.Today.AddDays(-11))
                                                         .Build();

            var engineers = new List <ISupportEngineer>()
            {
                engineer2WhoHadTwoShiftsInLastTwoWeeks, engineerWhoHadShiftYesterday,
                engineerWhoHadTwoShiftsInLastTwoWeeks, engineer1WhoDidnHadShiftYesterday,
                engineer2WhoDidnHadShiftYesterday
            };

            var supportEngineerRepository = A.Fake <ISupportEngineersRepository>();
            var supportEngineersFactory   = A.Fake <ISupportEngineersFactory>();

            A.CallTo(() => supportEngineersFactory.GetSupportEngineers())
            .Returns(engineers);

            //var supportEngineersFactory = new SupportEngineers
            var filterChainFactory = new DefaultSupportEngineerFilterChainFactory();

            var sut = new WheelOfFate(supportEngineerRepository, supportEngineersFactory, filterChainFactory);

            //act
            var bauShift = sut.SelectTodaysBauShift();

            //assert
            bauShift.ShouldNotBeNull();
            bauShift.Shift.ShouldNotBeEmpty();
        }