Ejemplo n.º 1
0
        CanAddSpotWithBreakType_SpotBreakTypeMatchesBreaksBreakType_SpotCanBeAddedToTheBreak()
        {
            // Arrange
            Break fakeBreak       = BreakWithValidBreakTypeFactory();
            var   fakeSmoothBreak = new SmoothBreak(fakeBreak, 1);

            var service = CanAddSpotService.Factory(fakeSmoothBreak);

            // Act
            var result = service.CanAddSpotWithBreakType(ValidBreakType);

            // Assert
            _ = result.Should().BeTrue(because: null);
        }
Ejemplo n.º 2
0
        public void Factory_PassesInContainerReference_ReturnsCanAddSpotToContainerService(string breakExternalReference)
        {
            // Arrange
            Break fakeBreak = BreakWithValidBreakTypeFactory();

            fakeBreak.ExternalBreakRef = breakExternalReference;

            // Act
            var service = CanAddSpotService.Factory(new SmoothBreak(fakeBreak, 1));

            // Assert
            _ = service.Should()
                .BeOfType <CanAddSpotToContainerService>(string.Empty, becauseArgs: null);
        }
        public void IsSpotEligible_SpotAndBreakBreakTypesMatchAndIgnoreSpotStartTime_SpotIsAllowed()
        {
            // Arrange
            Spot  fakeSpot  = SpotWithValidBreakTypeAndStartTimeFactory();
            Break fakeBreak = BreakWithValidBreakTypeFactory();

            var service = CanAddSpotService.Factory(new SmoothBreak(fakeBreak, 1));

            // Act
            var result = service.IsSpotEligibleWhenIgnoringSpotTime(fakeSpot);

            // Assert
            _ = result.Should().BeTrue(because: null);
        }
Ejemplo n.º 4
0
        CanAddSpotWithBreakType_SpotBreakTypeMismatchBreakBreakType_SpotCannotBeAddedToTheBreak()
        {
            // Arrange
            Break fakeBreak       = BreakWithValidBreakTypeFactory();
            var   fakeSmoothBreak = new SmoothBreak(fakeBreak, 1);

            var service = CanAddSpotService.Factory(fakeSmoothBreak);

            // Act
            var result = service.CanAddSpotWithBreakType("DF-DIFFERENT BREAK TYPE");

            // Assert
            _ = result.Should().BeFalse(because: null);
        }
        public void IsSpotEligible_SpotAndBreakBreakTypesMismatchesAndIgnoreSpotStartTime_SpotIsRejected()
        {
            // Arrange
            Spot fakeSpot = SpotWithValidBreakTypeAndStartTimeFactory();

            Break fakeBreak = BreakWithValidBreakTypeFactory();

            fakeBreak.BreakType += "Different";

            var service = CanAddSpotService.Factory(new SmoothBreak(fakeBreak, 1));

            // Act
            var result = service.IsSpotEligibleWhenIgnoringSpotTime(fakeSpot);

            // Assert
            _ = result.Should().BeFalse(because: null);
        }
        public void IsSpotEligible_SpotBreakTypeIsNullAndSpotStartTimeInsideBreak_SpotIsAllowed()
        {
            // Arrange
            Spot fakeSpot = SpotWithValidBreakTypeAndStartTimeFactory();

            fakeSpot.BreakType = null;

            Break fakeBreak = BreakWithValidBreakTypeFactory();

            var service = CanAddSpotService.Factory(new SmoothBreak(fakeBreak, 1));

            // Act
            var result = service.IsSpotEligibleWhenRespectingSpotTime(fakeSpot);

            // Assert
            _ = result.Should().BeTrue(because: null);
        }
        public void IsSpotEligible_MatchingBreakTypeAndSpotStartTimeAfterBreak_SpotIsRejected()
        {
            // Arrange
            Spot fakeSpot = SpotWithValidBreakTypeAndStartTimeFactory();

            MoveSpotByMinutes(fakeSpot, 10);

            Break fakeBreak = BreakWithValidBreakTypeFactory();

            var service = CanAddSpotService.Factory(new SmoothBreak(fakeBreak, 1));

            // Act
            var result = service.IsSpotEligibleWhenRespectingSpotTime(fakeSpot);

            // Assert
            _ = result.Should().BeFalse(because: null);
        }
        public void IsSpotEligible_SpotBreakTypeIsNullAndSpotStartTimeAfterBreak_SpotIsRejected()
        {
            // Arrange
            Spot fakeSpot = SpotWithValidBreakTypeAndStartTimeFactory();

            fakeSpot.BreakType = null;
            MoveSpotByMinutes(fakeSpot, 10);

            Break fakeBreak = BreakWithValidBreakTypeFactory();

            var service = CanAddSpotService.Factory(new SmoothBreak(fakeBreak, 1));

            // Act
            var result = service.IsSpotEligibleWhenRespectingSpotTime(fakeSpot);

            // Assert
            _ = result.Should().BeFalse(because: "the Break is before the allowed Spot time slot");
        }
        public void IsSpotEligible_MismatchingBreakTypeAndSpotStartTimeBeforeBreak_SpotIsRejected()
        {
            // Arrange
            Spot fakeSpot = SpotWithValidBreakTypeAndStartTimeFactory();

            MoveSpotByMinutes(fakeSpot, -10);

            Break fakeBreak = BreakWithValidBreakTypeFactory();

            fakeBreak.BreakType += "Different";

            var service = CanAddSpotService.Factory(new SmoothBreak(fakeBreak, 1));

            // Act
            var result = service.IsSpotEligibleWhenRespectingSpotTime(fakeSpot);

            // Assert
            _ = result.Should().BeFalse(because: "the Break is after the allowed Spot time slot");
        }