// Test commented out due to backing out of Roatp provider changes as not been tested
        //[Test]
        //public void ThenTheProviderDetailsAreStored()
        //{
        //    ConfigureEventsApi();
        //    ConfigureAgreementsApi();

        //    var cancellationTokenSource = new CancellationTokenSource();
        //    var cancellationToken = cancellationTokenSource.Token;
        //    Task.Run(() => WorkerRole.Run(), cancellationToken);

        //    var databaseAsExpected = TestHelper.ConditionMet(IsDatabaseInExpectedState, TimeSpan.FromSeconds(60));

        //    cancellationTokenSource.Cancel();
        //    Assert.IsTrue(databaseAsExpected);
        //}

        private async Task <bool> IsDatabaseInExpectedState()
        {
            var lastProcessedEventId = await EventTestsRepository.GetLastProcessedEventId <long>(EventName);

            if (lastProcessedEventId != 3)
            {
                return(false);
            }

            var numberOfProviders = await EventTestsRepository.GetNumberOfProviders();

            if (numberOfProviders != 1)
            {
                return(false);
            }

            return(true);
        }