public async Task WhenICreateTheFollowingEstates(Table table) { foreach (TableRow tableRow in table.Rows) { String estateName = SpecflowTableHelper.GetStringRowValue(tableRow, "EstateName"); CreateEstateRequest createEstateRequest = new CreateEstateRequest { EstateId = Guid.NewGuid(), EstateName = estateName }; CreateEstateResponse response = null; try { response = await this.TestingContext.DockerHelper.EstateClient .CreateEstate(this.TestingContext.AccessToken, createEstateRequest, CancellationToken.None) .ConfigureAwait(false); } catch (Exception e) { this.TestingContext.DockerHelper.Logger.LogInformation(e.Message); if (e.InnerException != null) { this.TestingContext.DockerHelper.Logger.LogInformation(e.InnerException.Message); if (e.InnerException.InnerException != null) { this.TestingContext.DockerHelper.Logger.LogInformation(e.InnerException.InnerException.Message); } } } response.ShouldNotBeNull(); response.EstateId.ShouldNotBe(Guid.Empty); // Cache the estate id this.TestingContext.AddEstateDetails(response.EstateId, estateName); //this.TestingContext.Logger.LogInformation($"Estate {estateName} created with Id {response.EstateId}"); } foreach (TableRow tableRow in table.Rows) { EstateDetails estateDetails = this.TestingContext.GetEstateDetails(tableRow); EstateResponse estate = null; await Retry.For(async() => { estate = await this.TestingContext.DockerHelper.EstateClient .GetEstate(this.TestingContext.AccessToken, estateDetails.EstateId, CancellationToken.None).ConfigureAwait(false); }); estate.ShouldNotBeNull(); estate.EstateName.ShouldBe(estateDetails.EstateName); } }
public void ModelFactory_Estate_WithNoOperatorsOrSecurityUsers_IsConverted() { Estate estateModel = TestData.EstateModel; ModelFactory modelFactory = new ModelFactory(); EstateResponse estateResponse = modelFactory.ConvertFrom(estateModel); estateResponse.ShouldNotBeNull(); estateResponse.EstateId.ShouldBe(estateModel.EstateId); estateResponse.EstateName.ShouldBe(estateModel.Name); }
public async Task WhenICreateTheFollowingEstates(Table table) { foreach (TableRow tableRow in table.Rows) { String estateName = SpecflowTableHelper.GetStringRowValue(tableRow, "EstateName"); // Setup the subscriptions for the estate await Retry.For(async() => { await this.TestingContext.DockerHelper.PopulateSubscriptionServiceConfiguration(estateName).ConfigureAwait(false); }, retryFor : TimeSpan.FromMinutes(2), retryInterval : TimeSpan.FromSeconds(30)); } foreach (TableRow tableRow in table.Rows) { String estateName = SpecflowTableHelper.GetStringRowValue(tableRow, "EstateName"); CreateEstateRequest createEstateRequest = new CreateEstateRequest { EstateId = Guid.NewGuid(), EstateName = estateName }; CreateEstateResponse response = null; await Retry.For(async() => { response = await this.TestingContext.DockerHelper.EstateClient .CreateEstate(this.TestingContext.AccessToken, createEstateRequest, CancellationToken.None) .ConfigureAwait(false); response.ShouldNotBeNull(); response.EstateId.ShouldNotBe(Guid.Empty); }, retryFor : TimeSpan.FromMinutes(1), retryInterval : TimeSpan.FromSeconds(30)); this.TestingContext.Logger.LogInformation($"Estate {estateName} created with Id {response.EstateId}"); EstateResponse estate = null; await Retry.For(async() => { estate = await this.TestingContext.DockerHelper.EstateClient .GetEstate(this.TestingContext.AccessToken, response.EstateId, CancellationToken.None).ConfigureAwait(false); estate.ShouldNotBeNull(); // Cache the estate id this.TestingContext.AddEstateDetails(estate.EstateId, estate.EstateName); }, TimeSpan.FromMinutes(3), TimeSpan.FromSeconds(30)).ConfigureAwait(false); estate.EstateName.ShouldBe(estateName); } }