public void ShouldCreateRequestWithPassedDataAndSpecifiedPollingConfiguration() { // arrange var configurationProvider = Substitute.For <IConfigurationProvider>(); var customAudienceId = Guid.NewGuid().ToString(); var updateUsersConfiguration = new UpdateUsersInCustomAudienceConfiguration { Data = new[] { Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString() }, FacebookApplicationsIds = new[] { Guid.NewGuid().ToString(), Guid.NewGuid().ToString() }, }; 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 removeUsersRequestBuilder = new RemoveUsersFromCustomAudienceRequestBuilder(configurationProvider, customAudienceId, updateUsersConfiguration); var removeUsersRequest = removeUsersRequestBuilder .WithPolling(polling => polling .Interval(expectedPollingRequestConfiguration.Interval) .Attempts(expectedPollingRequestConfiguration.Attempts)) .Create(); // assert removeUsersRequest.Should().NotBeNull(); removeUsersRequest.Configuration.Should().NotBeNull(); removeUsersRequest.Configuration.Users.Should().NotBeNull(); removeUsersRequest.Configuration.Users.ShouldBeEquivalentTo(updateUsersConfiguration); removeUsersRequest.Configuration.Polling.Should().NotBeNull(); removeUsersRequest.Configuration.Polling.ShouldBeEquivalentTo(expectedPollingRequestConfiguration); }
public void ShouldCreateRequestWithPassedDataAndDisabledPolling() { // arrange var configurationProvider = Substitute.For <IConfigurationProvider>(); var customAudienceId = Guid.NewGuid().ToString(); var updateUsersConfiguration = new UpdateUsersInCustomAudienceConfiguration { Data = new[] { Guid.NewGuid().ToString(), Guid.NewGuid().ToString(), Guid.NewGuid().ToString() }, FacebookApplicationsIds = new[] { Guid.NewGuid().ToString(), Guid.NewGuid().ToString() }, }; // act var removeUsersRequestBuilder = new RemoveUsersFromCustomAudienceRequestBuilder(configurationProvider, customAudienceId, updateUsersConfiguration); var removeUsersRequest = removeUsersRequestBuilder.Create(); // assert removeUsersRequest.Should().NotBeNull(); removeUsersRequest.Configuration.Should().NotBeNull(); removeUsersRequest.Configuration.Users.Should().NotBeNull(); removeUsersRequest.Configuration.Users.ShouldBeEquivalentTo(updateUsersConfiguration); removeUsersRequest.Configuration.Polling.Should().NotBeNull(); removeUsersRequest.Configuration.Polling.Enabled.Should().BeFalse(); }