Exemplo n.º 1
0
 public void NullSponsoredItemShouldThrowNull()
 {
     // Assert
     _ = Assert.Throws <ArgumentNullException>(() =>
     {
         // Act
         _ = SpotInspectorService.InspectSpot(
             null,
             _restrictionAvailabilitySeven,
             string.Empty,
             Duration.Zero,
             (false, string.Empty),
             (false, string.Empty));
     });
 }
Exemplo n.º 2
0
 public void NullRestrictionLimitsShouldThrowNull()
 {
     // Assert
     _ = Assert.Throws <ArgumentNullException>(() =>
     {
         // Act
         _ = SpotInspectorService.InspectSpot(
             _sponsoredItemAllCount,
             null,
             string.Empty,
             Duration.Zero,
             (false, string.Empty),
             (false, string.Empty));
     });
 }
Exemplo n.º 3
0
 public void NullSponsoredItemApplicabilityThowsNull()
 {
     // Assert
     _ = Assert.Throws <ArgumentNullException>(() =>
     {
         // Act
         _ = SpotInspectorService.InspectSpot(
             new SponsoredItem(),
             _restrictionAvailabilityZero,
             string.Empty,
             Duration.Zero,
             (true, string.Empty),
             (true, string.Empty));
     });
 }
Exemplo n.º 4
0
        public void EachCountClashComeptitorReturnsTrueClashFailureMessage()
        {
            // Act
            var(isAllowed, failureMessage) = SpotInspectorService.InspectSpot(
                _sponsoredItemEachCount,
                _restrictionAvailabilityOne,
                "product",
                Duration.Zero,
                (false, "advertiser"),
                (true, "clash"));

            // Assert
            _ = isAllowed.Should().BeTrue(becauseArgs: null);
            _ = failureMessage.Should().ContainSingle(becauseArgs: null);
            _ = failureMessage.FirstOrDefault().Should().Be(SmoothFailureMessages.T0_NoFailure, becauseArgs: null);
        }
Exemplo n.º 5
0
        public void EachCountAdvertiserComeptitorReturnsFalseAdvertiserFailureMessage()
        {
            // Act
            var(isAllowed, failureMessage) = SpotInspectorService.InspectSpot(
                _sponsoredItemEachCount,
                _restrictionAvailabilityZero,
                "product",
                Duration.Zero,
                (true, "advertiser"),
                (false, "clash"));

            // Assert
            _ = isAllowed.Should().BeFalse(becauseArgs: null);
            _ = failureMessage.Should().ContainSingle(becauseArgs: null);
            _ = failureMessage.FirstOrDefault().Should().Be(SmoothFailureMessages.T1_SponsorshipRestrictionAppliedForCompetitorSpotBasedOnCompetingAdvertiser, becauseArgs: null);
        }
        public void AllDurationAdvertiserClashComeptitorReturnsTrueNoFailureMessage()
        {
            // Act
            var(isAllowed, failureMessage) = SpotInspectorService.InspectSpot(
                _sponsoredItemAllDuration,
                _restrictionAvailabilitySeven,
                "product",
                Duration.FromSeconds(5),
                (true, "advertiser"),
                (true, "clash"));

            // Assert
            _ = isAllowed.Should().BeTrue(becauseArgs: null);
            _ = failureMessage.Should().ContainSingle(becauseArgs: null);
            _ = failureMessage.FirstOrDefault().Should().Be(SmoothFailureMessages.T0_NoFailure, becauseArgs: null);
        }
Exemplo n.º 7
0
        public void NotACompetitorSpotReturnsTrueAndNoFailure()
        {
            // Act
            var(isAllowed, failureMessage) =
                SpotInspectorService.InspectSpot(
                    _sponsoredItemEachCount,
                    _restrictionAvailabilityOne,
                    string.Empty,
                    Duration.Zero,
                    (false, string.Empty),
                    (false, string.Empty));

            // Assert
            _ = isAllowed.Should().BeTrue(becauseArgs: null);
            _ = failureMessage.Should().ContainSingle(becauseArgs: null);
            _ = failureMessage.FirstOrDefault().Should().Be(SmoothFailureMessages.T0_NoFailure, becauseArgs: null);
        }
Exemplo n.º 8
0
        public void NoCompetitorProductFoundInRestrictionShouldUseAdvertiserAndClash()
        {
            // Act
            var(isAllowed, failureMessage) =
                SpotInspectorService.InspectSpot(
                    _sponsoredItemEachCount,
                    _restrictionAvailabilityOne,
                    string.Empty,
                    Duration.Zero,
                    (true, "advertiser"),
                    (true, "clash"));

            // Assert
            _ = isAllowed.Should().BeTrue(becauseArgs: null);
            _ = failureMessage.Should().ContainSingle(becauseArgs: null);
            _ = failureMessage.FirstOrDefault().Should().Be(SmoothFailureMessages.T0_NoFailure, becauseArgs: null);
        }
        public void AllDurationAdvertiserClashComeptitorReturnsFalseAdvertiserClashFailureMessage()
        {
            // Act
            var(isAllowed, failureMessage) = SpotInspectorService.InspectSpot(
                _sponsoredItemAllDuration,
                _restrictionAvailabilitySeven,
                "product",
                Duration.FromSeconds(15),
                (true, "advertiser"),
                (true, "clash"));

            // Assert
            _ = isAllowed.Should().BeFalse(becauseArgs: null);
            _ = failureMessage.Should().HaveCount(2, becauseArgs: null);
            _ = failureMessage.FirstOrDefault().Should().Be(SmoothFailureMessages.T1_SponsorshipRestrictionAppliedForCompetitorSpotBasedOnCompetingAdvertiser, becauseArgs: null);
            _ = failureMessage.LastOrDefault().Should().Be(SmoothFailureMessages.T1_SponsorshipRestrictionAppliedForCompetitorSpotBasedOnCompetingClash, becauseArgs: null);
        }
Exemplo n.º 10
0
        public void NoProductFoundReturnsTrueAndNoFailure()
        {
            // Act
            var(isAllowed, failureMessage) =
                SpotInspectorService.InspectSpot(
                    _sponsoredItemEachCount,
                    _restrictionAvailabilityOne,
                    string.Empty,
                    Duration.Zero,
                    (true, "unavailable advertiser"),
                    (true, "unavailable clash"));

            // Assert
            _ = isAllowed.Should().BeFalse(becauseArgs: null);
            _ = failureMessage.Should().HaveCount(2, becauseArgs: null);
            _ = failureMessage.FirstOrDefault().Should().Be(SmoothFailureMessages.T1_SponsorshipRestrictionAppliedForCompetitorSpotBasedOnCompetingAdvertiser, becauseArgs: null);
            _ = failureMessage.LastOrDefault().Should().Be(SmoothFailureMessages.T1_SponsorshipRestrictionAppliedForCompetitorSpotBasedOnCompetingClash, becauseArgs: null);
        }