public void ShouldCreateRequestWithDefaultPollingConfiguration() { // arrange var configurationProvider = Substitute.For <IConfigurationProvider>(); var configuration = new Configuration { PollingConfiguration = new PollingConfiguration { DefaultAttemptsCount = 4, DefaultTimeInterval = TimeSpan.FromSeconds(15.0) } }; configurationProvider.GetConfiguration().Returns(configuration); // act var customAudiencesRequestBuilder = new CustomAudiencesRequestBuilder(configurationProvider); var customAudiencesRequest = customAudiencesRequestBuilder.WithPolling().Create(); // assert customAudiencesRequest.Should().NotBeNull(); customAudiencesRequest.Configuration.Should().NotBeNull(); customAudiencesRequest.Configuration.Polling.Should().NotBeNull(); customAudiencesRequest.Configuration.Polling.Enabled.Should().BeTrue(); customAudiencesRequest.Configuration.Polling.Attempts.Should().Be(configuration.PollingConfiguration.DefaultAttemptsCount); customAudiencesRequest.Configuration.Polling.Interval.Should().Be(configuration.PollingConfiguration.DefaultTimeInterval); }
public void ShouldCreateNewCustomAudienceRequestWithPassedData() { // arrange var configurationProvider = Substitute.For <IConfigurationProvider>(); var newCustomAudienceRequestConfiguration = new NewCustomAudienceRequestConfiguration { CustomAudience = { Name = Guid.NewGuid().ToString(), Description = Guid.NewGuid().ToString() } }; // act var customAudiencesRequestBuilder = new CustomAudiencesRequestBuilder(configurationProvider); var newCustomAudienceRequest = customAudiencesRequestBuilder .New(newCustomAudienceRequestConfiguration.CustomAudience) .Create(); // assert newCustomAudienceRequest.Should().NotBeNull(); newCustomAudienceRequest.Configuration.Should().NotBeNull(); newCustomAudienceRequest.Configuration.ShouldBeEquivalentTo(newCustomAudienceRequestConfiguration); }
public void ShouldCreateRequestWithDisabledPolling() { // arrange var configurationProvider = Substitute.For <IConfigurationProvider>(); // act var customAudiencesRequestBuilder = new CustomAudiencesRequestBuilder(configurationProvider); var customAudiencesRequest = customAudiencesRequestBuilder.Create(); // assert customAudiencesRequest.Should().NotBeNull(); customAudiencesRequest.Configuration.Should().NotBeNull(); customAudiencesRequest.Configuration.Polling.Should().NotBeNull(); customAudiencesRequest.Configuration.Polling.Enabled.Should().BeFalse(); }
public void ShouldCreateCustomAudienceRequestWithPassedData() { // arrange var configurationProvider = Substitute.For <IConfigurationProvider>(); var customAudienceRequestConfiguration = new CustomAudienceRequestConfiguration { CustomAudienceId = Guid.NewGuid().ToString() }; // act var customAudiencesRequestBuilder = new CustomAudiencesRequestBuilder(configurationProvider); var customAudienceRequest = customAudiencesRequestBuilder.CustomAudienceId(customAudienceRequestConfiguration.CustomAudienceId).Create(); // assert customAudienceRequest.Should().NotBeNull(); customAudienceRequest.Configuration.Should().NotBeNull(); customAudienceRequest.Configuration.ShouldBeEquivalentTo(customAudienceRequestConfiguration); }
public void ShouldCreateRequestWithSpecifiedPollingConfiguration() { // arrange var configurationProvider = Substitute.For <IConfigurationProvider>(); var configuration = new Configuration { PollingConfiguration = new PollingConfiguration { DefaultAttemptsCount = 4, DefaultTimeInterval = TimeSpan.FromSeconds(15.0) } }; var expectedPollingRequestConfiguration = new PollingRequestConfiguration { Enabled = true, Attempts = 6, Interval = TimeSpan.FromSeconds(10.0) }; configurationProvider.GetConfiguration().Returns(configuration); // act var customAudiencesRequestBuilder = new CustomAudiencesRequestBuilder(configurationProvider); var customAudiencesRequest = customAudiencesRequestBuilder .WithPolling(polling => polling .Interval(expectedPollingRequestConfiguration.Interval) .Attempts(expectedPollingRequestConfiguration.Attempts)) .Create(); // assert customAudiencesRequest.Should().NotBeNull(); customAudiencesRequest.Configuration.Should().NotBeNull(); customAudiencesRequest.Configuration.Polling.Should().NotBeNull(); customAudiencesRequest.Configuration.Polling.ShouldBeEquivalentTo(expectedPollingRequestConfiguration); }