public async Task WhenICallTheApiWithNoRoleToken_ThenACorrectResponseIsReturned() { var apiResponse = await ExchangeSetApiClient.GetProductIdentifiersDataAsync(Datahelper.GetProductIdentifierData(), accessToken : EssJwtTokenNoRole); Assert.AreEqual(200, (int)apiResponse.StatusCode, $"Incorrect status code {apiResponse.StatusCode} is returned, instead of the expected 200."); //Get the BatchId var batchId = await apiResponse.GetBatchId(); CleanUpBatchIdList.Add(batchId); }
public async Task WhenICallTheApiWithCustomToken_ThenAnUnauthorisedResponseIsReturned() { var apiResponse = await ExchangeSetApiClient.GetProductIdentifiersDataAsync(Datahelper.GetProductIdentifierData(), accessToken : EssJwtCustomizedToken); Assert.AreEqual(401, (int)apiResponse.StatusCode, $"Incorrect status code {apiResponse.StatusCode} is returned, instead of the expected 401."); }
public async Task WhenICallTheApiWithAValidProductIdentifierswithCallBackURI_ThenACorrectResponseIsReturned() { var apiResponse = await ExchangeSetApiClient.GetProductIdentifiersDataAsync(Datahelper.GetProductIdentifierData(), "https://fss.ukho.gov.uk/batch/7b4cdf10-adfa-4ed6-b2fe-d1543d8b7272%22", accessToken : EssJwtToken); Assert.AreEqual(200, (int)apiResponse.StatusCode, $"Incorrect status code is returned {apiResponse.StatusCode}, instead of of the expected status 200."); //Get the BatchId var batchId = await apiResponse.GetBatchId(); CleanUpBatchIdList.Add(batchId); }
public async Task WhenICallTheApiWithAInvalidCallbackURIWithProductIdentifier_ThenABadRequestResponseIsReturned(string callBackUrl) { var apiResponse = await ExchangeSetApiClient.GetProductIdentifiersDataAsync(Datahelper.GetProductIdentifierData(), callBackUrl, accessToken : EssJwtToken); Assert.AreEqual(400, (int)apiResponse.StatusCode, $"Incorrect status code is returned {apiResponse.StatusCode}, instead of the expected status 400."); var errorMessage = await apiResponse.ReadAsTypeAsync <ErrorDescriptionResponseModel>(); Assert.IsTrue(errorMessage.Errors.Any(e => e.Source == "callbackUri")); Assert.IsTrue(errorMessage.Errors.Any(e => e.Description == "Invalid callbackUri format.")); }
public async Task WhenICallTheApiWithAValidProductIdentifiers_ThenACorrectResponseIsReturned() { var apiResponse = await ExchangeSetApiClient.GetProductIdentifiersDataAsync(Datahelper.GetProductIdentifierData(), accessToken : EssJwtToken); Assert.AreEqual(200, (int)apiResponse.StatusCode, $"Incorrect status code is returned {apiResponse.StatusCode}, instead of the expected status 200."); //verify model structure await apiResponse.CheckModelStructureForSuccessResponse(); //Get the BatchId var batchId = await apiResponse.GetBatchId(); CleanUpBatchIdList.Add(batchId); }