diff --git a/.github/workflows/designer-dotnet-test.yaml b/.github/workflows/designer-dotnet-test.yaml
index a74051276cc..73ee96deeb4 100644
--- a/.github/workflows/designer-dotnet-test.yaml
+++ b/.github/workflows/designer-dotnet-test.yaml
@@ -17,7 +17,7 @@ jobs:
analyze:
strategy:
matrix:
- os: [ubuntu-latest] #windows-latest and macos-latest excluded temporarily
+ os: [ubuntu-latest,windows-latest,macos-latest] #windows-latest and macos-latest excluded temporarily
name: Run dotnet build and test
runs-on: ${{ matrix.os}}
env:
@@ -33,7 +33,7 @@ jobs:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Build
run: |
- dotnet build backend/Designer.sln -v n -nodereuse:false
+ dotnet build backend/Designer.sln -v m
- name: Test
run: |
- dotnet test backend/Designer.sln --filter Category!=GiteaIntegrationTest -v n --no-build
+ dotnet test backend/Designer.sln --filter FullyQualifiedName~AppDevelopmentController --no-build; dotnet test backend/Designer.sln --filter FullyQualifiedName~PreviewController --no-build; dotnet test backend/Designer.sln --filter "(Category!=GiteaIntegrationTest)&(FullyQualifiedName!~AppDevelopmentController)&(FullyQualifiedName!~PreviewController)" -v m --no-build
diff --git a/backend/src/Designer/Program.cs b/backend/src/Designer/Program.cs
index 353d468347f..00eb3c4d778 100644
--- a/backend/src/Designer/Program.cs
+++ b/backend/src/Designer/Program.cs
@@ -359,3 +359,5 @@ static string GetXmlCommentsPathForControllers()
return xmlPath;
}
+
+public partial class Program { }
diff --git a/backend/src/Designer/Services/Interfaces/IProcessModelingService.cs b/backend/src/Designer/Services/Interfaces/IProcessModelingService.cs
index d7117d1d69d..490adac1a71 100644
--- a/backend/src/Designer/Services/Interfaces/IProcessModelingService.cs
+++ b/backend/src/Designer/Services/Interfaces/IProcessModelingService.cs
@@ -37,7 +37,6 @@ public interface IProcessModelingService
/// Gets the process definition file stream for a given app.
///
/// An .
- /// A that observes if operation is cancelled.
/// A of a process definition file.
Stream GetProcessDefinitionStream(AltinnRepoEditingContext altinnRepoEditingContext);
}
diff --git a/backend/tests/Designer.Tests/Controllers/ApiTests/ApiTestsBase.cs b/backend/tests/Designer.Tests/Controllers/ApiTests/ApiTestsBase.cs
index 9e94e66f1ce..ee575351fb9 100644
--- a/backend/tests/Designer.Tests/Controllers/ApiTests/ApiTestsBase.cs
+++ b/backend/tests/Designer.Tests/Controllers/ApiTests/ApiTestsBase.cs
@@ -2,17 +2,12 @@
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Net.Http;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.AspNetCore.Mvc.Testing.Handlers;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
using SharedResources.Tests;
-using Xunit;
using static Designer.Tests.Utils.TestSetupUtils;
namespace Designer.Tests.Controllers.ApiTests;
@@ -20,18 +15,22 @@ namespace Designer.Tests.Controllers.ApiTests;
///
/// Base class for testing controller endpoints.
///
-/// Provided controller type.
/// Controller test class type. Used for generating fluent tests.
[ExcludeFromCodeCoverage]
-public abstract class ApiTestsBase : FluentTestsBase,
- IClassFixture>
- where TController : ControllerBase
- where TControllerTest : class
+public abstract class ApiTestsBase : FluentTestsBase, IDisposable where TControllerTest : class
{
+ private HttpClient _httpClient;
+
///
/// HttpClient that should call endpoints of a provided controller.
///
- protected Lazy HttpClient { get; }
+ protected HttpClient HttpClient
+ {
+ get
+ {
+ return _httpClient ??= GetTestClient();
+ }
+ }
///
/// When overridden tests services will be configured.
@@ -50,12 +49,11 @@ public abstract class ApiTestsBase : FluentTestsBa
protected virtual string TestRepositoriesLocation =>
Path.Combine(UnitTestsFolder, "..", "..", "..", "_TestData", "Repositories");
- protected readonly WebApplicationFactory Factory;
+ protected readonly WebApplicationFactory Factory;
- protected ApiTestsBase(WebApplicationFactory factory)
+ protected ApiTestsBase(WebApplicationFactory factory)
{
Factory = factory;
- HttpClient = new Lazy(GetTestClient);
SetupDirtyHackIfLinux();
}
@@ -67,15 +65,11 @@ protected ApiTestsBase(WebApplicationFactory factory)
protected virtual HttpClient GetTestClient()
{
string configPath = GetConfigPath();
-
- var client = Factory.WithWebHostBuilder(builder =>
+ return Factory.WithWebHostBuilder(builder =>
{
- builder.UseTestServer();
builder.ConfigureAppConfiguration((_, conf) => { conf.AddJsonFile(configPath); });
-
builder.ConfigureTestServices(ConfigureTestServices);
}).CreateDefaultClient(new ApiTestsAuthAndCookieDelegatingHandler(), new CookieContainerHandler());
- return client;
}
///
@@ -87,4 +81,11 @@ protected virtual string GetConfigPath()
string projectDir = Directory.GetCurrentDirectory();
return Path.Combine(projectDir, "appsettings.json");
}
+ public void Dispose()
+ {
+ Dispose(true);
+ }
+ protected virtual void Dispose(bool disposing)
+ {
+ }
}
diff --git a/backend/tests/Designer.Tests/Controllers/ApiTests/DisagnerEndpointsTestsBase.cs b/backend/tests/Designer.Tests/Controllers/ApiTests/DisagnerEndpointsTestsBase.cs
index 6bcb8462e50..2d0923a21a3 100644
--- a/backend/tests/Designer.Tests/Controllers/ApiTests/DisagnerEndpointsTestsBase.cs
+++ b/backend/tests/Designer.Tests/Controllers/ApiTests/DisagnerEndpointsTestsBase.cs
@@ -1,4 +1,5 @@
using System;
+using System.IO;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Serialization;
@@ -17,10 +18,8 @@ namespace Designer.Tests.Controllers.ApiTests
/// More adjusted version of the ApiTestsBase class that is used for testing controllers that contains org and repo in the path.
/// Provides functionality for copying a repository from the test repositories location to a temporary location for testing which is disposed after execution of the test.
///
- /// Controller type.
/// Tests class type.
- public abstract class DisagnerEndpointsTestsBase : ApiTestsBase, IDisposable
- where TController : ControllerBase
+ public abstract class DisagnerEndpointsTestsBase : ApiTestsBase
where TControllerTest : class
{
///
@@ -49,7 +48,7 @@ protected override void ConfigureTestServices(IServiceCollection services)
Converters = { new JsonStringEnumConverter() }
};
- public DisagnerEndpointsTestsBase(WebApplicationFactory factory) : base(factory)
+ public DisagnerEndpointsTestsBase(WebApplicationFactory factory) : base(factory)
{
}
@@ -90,19 +89,20 @@ protected async Task CopyRemoteRepositoryForTest(string org, string repo, string
RemoteTestRepoPath = await TestDataHelper.CopyRemoteRepositoryForTest(org, repo, targetRepository);
}
- public void Dispose()
+ protected override void Dispose(bool disposing)
{
- if (!string.IsNullOrWhiteSpace(TestRepoPath))
+ base.Dispose(disposing);
+ if (!disposing)
{
- TestDataHelper.DeleteDirectory(TestRepoPath);
+ return;
}
- if (!string.IsNullOrWhiteSpace(RemoteTestRepoPath))
+ if (!string.IsNullOrWhiteSpace(TestRepoPath))
{
- TestDataHelper.DeleteDirectory(RemoteTestRepoPath);
+ Directory.Delete(TestRepoPath, true);
}
- if (HttpClient.IsValueCreated)
+ if (!string.IsNullOrWhiteSpace(RemoteTestRepoPath))
{
- HttpClient.Value.Dispose();
+ Directory.Delete(RemoteTestRepoPath, true);
}
}
}
diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/DeleteFormLayoutTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/DeleteFormLayoutTests.cs
index 3ae582ffeea..8f782c082f0 100644
--- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/DeleteFormLayoutTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/DeleteFormLayoutTests.cs
@@ -11,10 +11,10 @@
namespace Designer.Tests.Controllers.AppDevelopmentController
{
- public class DeleteFormLayoutTests : DisagnerEndpointsTestsBase
+ public class DeleteFormLayoutTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/app-development";
- public DeleteFormLayoutTests(WebApplicationFactory factory) : base(factory)
+ public DeleteFormLayoutTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -30,7 +30,7 @@ public async Task DeleteFormLayout_ShouldDeleteLayoutFile_AndReturnOk(string org
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK);
string relativePath = string.IsNullOrEmpty(layoutSetName)
@@ -52,7 +52,7 @@ public async Task DeleteFormLayout_NonExistingFile_Should_AndReturnNotFound(stri
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.NotFound);
}
}
diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetFormLayoutsTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetFormLayoutsTests.cs
index 9a26d9f74f1..7b997c99a73 100644
--- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetFormLayoutsTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetFormLayoutsTests.cs
@@ -16,10 +16,10 @@
namespace Designer.Tests.Controllers.AppDevelopmentController
{
- public class GetFormLayoutsTests : DisagnerEndpointsTestsBase
+ public class GetFormLayoutsTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/app-development";
- public GetFormLayoutsTests(WebApplicationFactory factory) : base(factory)
+ public GetFormLayoutsTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -35,7 +35,7 @@ public async Task GetAppDevelopment_ShouldReturnLayouts(string org, string app,
string url = $"{VersionPrefix(org, targetRepository)}/form-layouts?layoutSetName={layoutSetName}";
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK);
string responseContent = await response.Content.ReadAsStringAsync();
diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetLayoutSettingsTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetLayoutSettingsTests.cs
index 73ba75ffc1b..7987a91af00 100644
--- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetLayoutSettingsTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetLayoutSettingsTests.cs
@@ -11,10 +11,10 @@
namespace Designer.Tests.Controllers.AppDevelopmentController
{
- public class GetLayoutSettingsTests : DisagnerEndpointsTestsBase
+ public class GetLayoutSettingsTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/app-development";
- public GetLayoutSettingsTests(WebApplicationFactory factory) : base(factory)
+ public GetLayoutSettingsTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -35,7 +35,7 @@ public async Task GetLayoutSettings_ShouldReturnLayouts(string org, string app,
string url = $"{VersionPrefix(org, targetRepository)}/layout-settings?layoutSetName={layoutSetName}";
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK);
string responseContent = await response.Content.ReadAsStringAsync();
@@ -50,7 +50,7 @@ public async Task GetLayoutSettings_IfNotExists_Should_AndReturnNotFound(string
string url = $"{VersionPrefix(org, app)}/layout-settings?layoutSetName={layoutSetName}";
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.NotFound);
}
diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetOptionListIdsTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetOptionListIdsTests.cs
index 4faef2e59bd..fa89b1e0890 100644
--- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetOptionListIdsTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetOptionListIdsTests.cs
@@ -11,10 +11,10 @@
namespace Designer.Tests.Controllers.AppDevelopmentController
{
- public class GetOptionListIdsTests : DisagnerEndpointsTestsBase
+ public class GetOptionListIdsTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/app-development";
- public GetOptionListIdsTests(WebApplicationFactory factory) : base(factory)
+ public GetOptionListIdsTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -34,7 +34,7 @@ public async Task GetOptionsListIds_ShouldReturnOk(string org, string app, strin
string url = $"{VersionPrefix(org, targetRepository)}/option-list-ids";
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK);
string responseContent = await response.Content.ReadAsStringAsync();
@@ -53,7 +53,7 @@ public async Task GetOptionsListIds_WhenNotExists_ReturnsNotFound(string org, st
string url = $"{VersionPrefix(org, app)}/option-list-ids";
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.NoContent);
}
diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetRuleConfigTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetRuleConfigTests.cs
index 7b4925f715d..e5894e8b1c5 100644
--- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetRuleConfigTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetRuleConfigTests.cs
@@ -11,10 +11,10 @@
namespace Designer.Tests.Controllers.AppDevelopmentController
{
- public class GetRuleConfigTests : DisagnerEndpointsTestsBase
+ public class GetRuleConfigTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/app-development";
- public GetRuleConfigTests(WebApplicationFactory factory) : base(factory)
+ public GetRuleConfigTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -32,7 +32,7 @@ public async Task GetRuleConfig_ShouldReturnOK(string org, string app, string de
string url = $"{VersionPrefix(org, targetRepository)}/rule-config?layoutSetName={layoutSetName}";
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK);
string responseContent = await response.Content.ReadAsStringAsync();
@@ -46,7 +46,7 @@ public async Task GetRuleConfig_WhenNotExists_ReturnsNotFound(string org, string
string url = $"{VersionPrefix(org, app)}/rule-config?layoutSetName={layoutSetName}";
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.NoContent);
}
@@ -64,7 +64,7 @@ public async Task GetRuleConfig_WhenFileMissesDataOnRoot_ReturnsFixedFile(string
string url = $"{VersionPrefix(org, targetRepository)}/rule-config?layoutSetName={layoutSetName}";
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK);
string responseContent = await response.Content.ReadAsStringAsync();
diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetRuleHandlerTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetRuleHandlerTests.cs
index e182b5a16db..1a926588629 100644
--- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetRuleHandlerTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetRuleHandlerTests.cs
@@ -11,10 +11,10 @@
namespace Designer.Tests.Controllers.AppDevelopmentController
{
- public class GetRuleHandlerTests : DisagnerEndpointsTestsBase
+ public class GetRuleHandlerTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/app-development";
- public GetRuleHandlerTests(WebApplicationFactory factory) : base(factory)
+ public GetRuleHandlerTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -35,7 +35,7 @@ public async Task GetRuleHandler_ShouldReturnJsContent(string org, string app, s
string url = $"{VersionPrefix(org, targetRepository)}/rule-handler?layoutSetName={layoutSetName}";
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK);
string responseContent = await response.Content.ReadAsStringAsync();
@@ -50,7 +50,7 @@ public async Task GetRuleHandler_IfNotExists_Should_AndReturnNotFound(string org
string url = $"{VersionPrefix(org, app)}/rule-handler?layoutSetName={layoutSetName}";
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.NotFound);
string content = await response.Content.ReadAsStringAsync();
content.Should().Be("Could not find rule handler in app.");
diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetVersionOfTheAppLibTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetVersionOfTheAppLibTests.cs
index 55143b3b2ef..e2c69d829a7 100644
--- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetVersionOfTheAppLibTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/GetVersionOfTheAppLibTests.cs
@@ -12,10 +12,10 @@
namespace Designer.Tests.Controllers.AppDevelopmentController
{
- public class GetVersionOfTheAppLibTests : DisagnerEndpointsTestsBase
+ public class GetVersionOfTheAppLibTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/app-development/app-lib-version";
- public GetVersionOfTheAppLibTests(WebApplicationFactory factory) : base(factory)
+ public GetVersionOfTheAppLibTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -30,7 +30,7 @@ public async Task GetAppLibVersion_GivenCsProjFile_ShouldReturnOK(string org, st
string url = VersionPrefix(org, targetRepository);
- using var response = await HttpClient.Value.GetAsync(url);
+ using var response = await HttpClient.GetAsync(url);
response.StatusCode.Should().Be(HttpStatusCode.OK);
var responseVersion = await response.Content.ReadAsAsync();
@@ -47,7 +47,7 @@ public async Task GetAppLibVersion_GivenCsprojFileWithoutAppLib_ShouldReturn404(
await AddCsProjToRepo("App/App.csproj", csprojTemplate);
string url = VersionPrefix(org, targetRepository);
- using var response = await HttpClient.Value.GetAsync(url);
+ using var response = await HttpClient.GetAsync(url);
response.StatusCode.Should().Be(HttpStatusCode.NotFound);
}
@@ -57,7 +57,7 @@ public async Task GetAppLibVersion_NotGivenCsprojFile_ShouldReturn404(string org
{
string url = VersionPrefix(org, app);
- using var response = await HttpClient.Value.GetAsync(url);
+ using var response = await HttpClient.GetAsync(url);
response.StatusCode.Should().Be(HttpStatusCode.NotFound);
}
diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveFormLayoutTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveFormLayoutTests.cs
index 5481f495723..15c3b4566b8 100644
--- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveFormLayoutTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveFormLayoutTests.cs
@@ -12,10 +12,10 @@
namespace Designer.Tests.Controllers.AppDevelopmentController
{
- public class SaveFormLayoutTestsBase : DisagnerEndpointsTestsBase
+ public class SaveFormLayoutTestsBase : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/app-development";
- public SaveFormLayoutTestsBase(WebApplicationFactory factory) : base(factory)
+ public SaveFormLayoutTestsBase(WebApplicationFactory factory) : base(factory)
{
}
@@ -48,7 +48,7 @@ public async Task SaveFormLayout_ReturnsOk(string org, string app, string develo
Content = new StringContent(layout, Encoding.UTF8, MediaTypeNames.Application.Json)
};
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK);
string relativePath = string.IsNullOrEmpty(layoutSetName)
diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveLayoutSettingsTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveLayoutSettingsTests.cs
index 64fb9f767a3..fdc10ce82ec 100644
--- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveLayoutSettingsTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveLayoutSettingsTests.cs
@@ -12,11 +12,11 @@
namespace Designer.Tests.Controllers.AppDevelopmentController
{
- public class SaveLayoutSettingsTests : DisagnerEndpointsTestsBase
+ public class SaveLayoutSettingsTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/app-development";
- public SaveLayoutSettingsTests(WebApplicationFactory factory) : base(factory)
+ public SaveLayoutSettingsTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -43,7 +43,7 @@ public async Task SaveLayoutSettings_ReturnsOk(string org, string app, string de
Content = new StringContent(layoutSettings, Encoding.UTF8, MediaTypeNames.Application.Json)
};
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK);
string relativePath = string.IsNullOrEmpty(layoutSetName)
diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveRuleConfigTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveRuleConfigTests.cs
index 2917bc7c1d4..1872a94031e 100644
--- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveRuleConfigTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveRuleConfigTests.cs
@@ -12,11 +12,11 @@
namespace Designer.Tests.Controllers.AppDevelopmentController
{
- public class SaveRuleConfigTests : DisagnerEndpointsTestsBase
+ public class SaveRuleConfigTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/app-development";
- public SaveRuleConfigTests(WebApplicationFactory factory) : base(factory)
+ public SaveRuleConfigTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -38,7 +38,7 @@ public async Task SaveRuleConfiguration_ShouldCreateRuleConfigurationFile_AndRet
Content = new StringContent(content, Encoding.UTF8, MediaTypeNames.Application.Json)
};
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK);
string relativePath = string.IsNullOrEmpty(layoutSetName)
diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveRuleHandlerTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveRuleHandlerTests.cs
index 2a34bb4be83..8d950cf5717 100644
--- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveRuleHandlerTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/SaveRuleHandlerTests.cs
@@ -15,11 +15,11 @@
namespace Designer.Tests.Controllers.AppDevelopmentController
{
- public class SaveRuleHandlerTests : DisagnerEndpointsTestsBase
+ public class SaveRuleHandlerTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/app-development";
- public SaveRuleHandlerTests(WebApplicationFactory factory) : base(factory)
+ public SaveRuleHandlerTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -51,7 +51,7 @@ public async Task SaveRuleHandler_ShouldCreateRuleHandlerFile_AndReturnNoContent
Content = new StringContent(content, Encoding.UTF8)
};
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.NoContent);
string relativePath = string.IsNullOrEmpty(layoutSetName)
diff --git a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/UpdateFormLayoutNameTests.cs b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/UpdateFormLayoutNameTests.cs
index 825ddb6c9e4..378d5ef60e7 100644
--- a/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/UpdateFormLayoutNameTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/AppDevelopmentController/UpdateFormLayoutNameTests.cs
@@ -12,10 +12,10 @@
namespace Designer.Tests.Controllers.AppDevelopmentController
{
- public class UpdateFormLayoutNameTests : DisagnerEndpointsTestsBase
+ public class UpdateFormLayoutNameTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/app-development";
- public UpdateFormLayoutNameTests(WebApplicationFactory factory) : base(factory)
+ public UpdateFormLayoutNameTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -36,7 +36,7 @@ public async Task UpdateFormLayoutName_Change_FileName_And_ReturnsOk(string org,
Content = new StringContent($"\"{newLayoutName}\"", Encoding.UTF8, MediaTypeNames.Application.Json)
};
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK);
string relativeOldLayoutPath = string.IsNullOrEmpty(layoutSetName)
@@ -65,7 +65,7 @@ public async Task UpdateFormLayoutName_NonExistingName_ShouldReturnNotFound(stri
Content = new StringContent($"\"{newLayoutName}\"", Encoding.UTF8, MediaTypeNames.Application.Json)
};
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.NotFound);
}
diff --git a/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/AddMetadataForAttachmentTests.cs b/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/AddMetadataForAttachmentTests.cs
index 241951747b8..68df3fabdf3 100644
--- a/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/AddMetadataForAttachmentTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/AddMetadataForAttachmentTests.cs
@@ -16,10 +16,10 @@
namespace Designer.Tests.Controllers.ApplicationMetadataController
{
- public class AddMetadataForAttachmentTests : DisagnerEndpointsTestsBase
+ public class AddMetadataForAttachmentTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/metadata";
- public AddMetadataForAttachmentTests(WebApplicationFactory factory) : base(factory)
+ public AddMetadataForAttachmentTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -34,7 +34,7 @@ public async Task AddMetadataForAttachment_WhenExists_ShouldReturnConflict(strin
// payload
using var payloadContent = new StringContent(JsonSerializer.Serialize(payload, JsonSerializerOptions), Encoding.UTF8, MediaTypeNames.Application.Json);
- using var response = await HttpClient.Value.PostAsync(url, payloadContent);
+ using var response = await HttpClient.PostAsync(url, payloadContent);
response.StatusCode.Should().Be(HttpStatusCode.OK);
diff --git a/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/CreateApplicationMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/CreateApplicationMetadataTests.cs
index b5e29e1123a..9daae5fa108 100644
--- a/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/CreateApplicationMetadataTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/CreateApplicationMetadataTests.cs
@@ -10,10 +10,10 @@
namespace Designer.Tests.Controllers.ApplicationMetadataController
{
- public class CreateApplicationMetadataTests : DisagnerEndpointsTestsBase
+ public class CreateApplicationMetadataTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/metadata";
- public CreateApplicationMetadataTests(WebApplicationFactory factory) : base(factory)
+ public CreateApplicationMetadataTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -27,7 +27,7 @@ public async Task CreateApplicationMetadata_WhenExists_ShouldReturnConflict(stri
string url = VersionPrefix(org, targetRepository);
using HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, url);
- using var response = await HttpClient.Value.SendAsync(request);
+ using var response = await HttpClient.SendAsync(request);
response.StatusCode.Should().Be(HttpStatusCode.Conflict);
}
@@ -44,7 +44,7 @@ public async Task CreateApplicationMetadata_ShouldReturnOK(string org, string ap
string url = VersionPrefix(org, targetRepository);
using HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, url);
- using var response = await HttpClient.Value.SendAsync(request);
+ using var response = await HttpClient.SendAsync(request);
response.StatusCode.Should().Be(HttpStatusCode.Created);
}
diff --git a/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/DeleteMetadataForAttachmentTests.cs b/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/DeleteMetadataForAttachmentTests.cs
index cd30c726493..b6adf009a01 100644
--- a/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/DeleteMetadataForAttachmentTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/DeleteMetadataForAttachmentTests.cs
@@ -13,10 +13,10 @@
namespace Designer.Tests.Controllers.ApplicationMetadataController
{
- public class DeleteMetadataForAttachmentTests : DisagnerEndpointsTestsBase
+ public class DeleteMetadataForAttachmentTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/metadata";
- public DeleteMetadataForAttachmentTests(WebApplicationFactory factory) : base(factory)
+ public DeleteMetadataForAttachmentTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -34,7 +34,7 @@ public async Task DeleteMetadataForAttachment_WhenExists_ShouldReturnOk(string o
using var requestMessage = new HttpRequestMessage(HttpMethod.Delete, url);
requestMessage.Content = new StringContent($"\"{attacmentIdToDelete}\"", Encoding.UTF8, MediaTypeNames.Application.Json);
- var response = await HttpClient.Value.SendAsync(requestMessage);
+ var response = await HttpClient.SendAsync(requestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK);
string currentMetadata = TestDataHelper.GetFileFromRepo(org, targetRepository, developer, "App/config/applicationmetadata.json");
diff --git a/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/GetApplicationMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/GetApplicationMetadataTests.cs
index ebde04b8611..956ab916335 100644
--- a/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/GetApplicationMetadataTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/GetApplicationMetadataTests.cs
@@ -12,10 +12,10 @@
namespace Designer.Tests.Controllers.ApplicationMetadataController
{
- public class GetApplicationMetadataTests : DisagnerEndpointsTestsBase
+ public class GetApplicationMetadataTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/metadata";
- public GetApplicationMetadataTests(WebApplicationFactory factory) : base(factory)
+ public GetApplicationMetadataTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -32,7 +32,7 @@ public async Task GetApplicationMetadata_ShouldReturnOK(string org, string app,
await File.WriteAllTextAsync(filePath, metadataFile);
string url = VersionPrefix(org, targetRepository);
- var response = await HttpClient.Value.GetAsync(url);
+ var response = await HttpClient.GetAsync(url);
response.StatusCode.Should().Be(HttpStatusCode.OK);
string responseContent = await response.Content.ReadAsStringAsync();
diff --git a/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/UpdateApplicationMetadataTests.cs b/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/UpdateApplicationMetadataTests.cs
index e92f19c9b66..a5d9c7f8479 100644
--- a/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/UpdateApplicationMetadataTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/UpdateApplicationMetadataTests.cs
@@ -14,10 +14,10 @@
namespace Designer.Tests.Controllers.ApplicationMetadataController
{
- public class UpdateApplicationMetadataTests : DisagnerEndpointsTestsBase
+ public class UpdateApplicationMetadataTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/metadata";
- public UpdateApplicationMetadataTests(WebApplicationFactory factory) : base(factory)
+ public UpdateApplicationMetadataTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -33,7 +33,7 @@ public async Task UpdateApplicationMetadata_WhenExists_ShouldReturnConflict(stri
string url = VersionPrefix(org, targetRepository);
- var response = await HttpClient.Value.PutAsync(url, new StringContent(metadata, Encoding.UTF8, MediaTypeNames.Application.Json));
+ using var response = await HttpClient.PutAsync(url, new StringContent(metadata, Encoding.UTF8, MediaTypeNames.Application.Json));
response.StatusCode.Should().Be(HttpStatusCode.OK);
string responseContent = await response.Content.ReadAsStringAsync();
diff --git a/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/UpdateMetadataForAttachmentTests.cs b/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/UpdateMetadataForAttachmentTests.cs
index af5e1d6bb5c..d9bf973552e 100644
--- a/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/UpdateMetadataForAttachmentTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/ApplicationMetadataController/UpdateMetadataForAttachmentTests.cs
@@ -17,10 +17,10 @@
namespace Designer.Tests.Controllers.ApplicationMetadataController
{
- public class UpdateMetadataForAttachmentTests : DisagnerEndpointsTestsBase
+ public class UpdateMetadataForAttachmentTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/metadata";
- public UpdateMetadataForAttachmentTests(WebApplicationFactory factory) : base(factory)
+ public UpdateMetadataForAttachmentTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -41,7 +41,7 @@ public async Task UpdateMetadataForAttachment_WhenExists_ShouldReturnConflict(st
// payload
using var payloadContent = new StringContent(payload, Encoding.UTF8, MediaTypeNames.Application.Json);
- using var response = await HttpClient.Value.PutAsync(url, payloadContent);
+ using var response = await HttpClient.PutAsync(url, payloadContent);
response.StatusCode.Should().Be(HttpStatusCode.OK);
diff --git a/backend/tests/Designer.Tests/Controllers/ConfigController/GetServiceConfigTests.cs b/backend/tests/Designer.Tests/Controllers/ConfigController/GetServiceConfigTests.cs
index 5d13836399a..20e1aa0cfff 100644
--- a/backend/tests/Designer.Tests/Controllers/ConfigController/GetServiceConfigTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/ConfigController/GetServiceConfigTests.cs
@@ -8,10 +8,10 @@
namespace Designer.Tests.Controllers.ConfigController
{
- public class GetServiceConfigTests : DisagnerEndpointsTestsBase
+ public class GetServiceConfigTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/config";
- public GetServiceConfigTests(WebApplicationFactory factory) : base(factory)
+ public GetServiceConfigTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -22,7 +22,7 @@ public async Task GetServiceConfig_AppWithoutConfig_OK(string org, string app)
string dataPathWithData = VersionPrefix(org, app);
using HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, dataPathWithData);
- using HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
ServiceConfiguration serviceConfigResponse = await response.Content.ReadAsAsync();
ServiceConfiguration serviceConfiguration = new ServiceConfiguration { RepositoryName = app, ServiceDescription = null, ServiceId = null, ServiceName = null };
@@ -38,7 +38,7 @@ public async Task GetServiceConfig_AppWithConfig_OK(string org, string app)
string dataPathWithData = VersionPrefix(org, app);
using HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, dataPathWithData);
- using HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
ServiceConfiguration serviceConfigResponse = await response.Content.ReadAsAsync();
ServiceConfiguration serviceConfiguration = ServiceConfigurationUtils.GetServiceConfiguration(TestRepositoriesLocation, org, app, "testUser");
diff --git a/backend/tests/Designer.Tests/Controllers/ConfigController/SetServiceConfigTests.cs b/backend/tests/Designer.Tests/Controllers/ConfigController/SetServiceConfigTests.cs
index 8eaadd8e1a9..9ea6f6a1e60 100644
--- a/backend/tests/Designer.Tests/Controllers/ConfigController/SetServiceConfigTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/ConfigController/SetServiceConfigTests.cs
@@ -10,10 +10,10 @@
namespace Designer.Tests.Controllers.ConfigController
{
- public class SetServiceConfigTests : DisagnerEndpointsTestsBase
+ public class SetServiceConfigTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/config";
- public SetServiceConfigTests(WebApplicationFactory factory) : base(factory)
+ public SetServiceConfigTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -28,7 +28,7 @@ public async Task SetServiceConfig_OK(string org, string app, string developer)
using HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, dataPathWithData);
httpRequestMessage.Content = JsonContent.Create(new { serviceName = "Alternative-form-name", serviceDescription = "", serviceId = "" });
- using HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
ServiceConfiguration serviceConfiguration = ServiceConfigurationUtils.GetServiceConfiguration(TestRepositoriesLocation, org, targetRepository, "testUser");
diff --git a/backend/tests/Designer.Tests/Controllers/DataModelsController/AddXsdTests.cs b/backend/tests/Designer.Tests/Controllers/DataModelsController/AddXsdTests.cs
index f5b21171a32..4c79a5249ab 100644
--- a/backend/tests/Designer.Tests/Controllers/DataModelsController/AddXsdTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/DataModelsController/AddXsdTests.cs
@@ -11,10 +11,10 @@
namespace Designer.Tests.Controllers.DataModelsController;
-public class AddXsdTests : DisagnerEndpointsTestsBase
+public class AddXsdTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/datamodels";
- public AddXsdTests(WebApplicationFactory factory) : base(factory)
+ public AddXsdTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -39,7 +39,7 @@ public async Task AddXsd_AppRepo_PreferredXsd_ShouldReturnCreated(string org, st
Content = formData
};
- var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ var response = await HttpClient.SendAsync(httpRequestMessage);
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
}
@@ -64,7 +64,7 @@ public async Task AddXsd_AppRepo_PreferredJson_ShouldReturnCreated(string org, s
Content = formData
};
- var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ var response = await HttpClient.SendAsync(httpRequestMessage);
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
}
@@ -89,7 +89,7 @@ public async Task AddXsd_DatamodelsRepo_NonAsciiName_ShouldReturnCreated(string
Content = formData
};
- var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ var response = await HttpClient.SendAsync(httpRequestMessage);
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
}
}
diff --git a/backend/tests/Designer.Tests/Controllers/DataModelsController/DeleteDatamodelTests.cs b/backend/tests/Designer.Tests/Controllers/DataModelsController/DeleteDatamodelTests.cs
index 6a064ad3586..d5a30c21f21 100644
--- a/backend/tests/Designer.Tests/Controllers/DataModelsController/DeleteDatamodelTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/DataModelsController/DeleteDatamodelTests.cs
@@ -14,12 +14,12 @@
namespace Designer.Tests.Controllers.DataModelsController;
-public class DeleteDatamodelTests : DisagnerEndpointsTestsBase
+public class DeleteDatamodelTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/datamodels";
private readonly Mock _repositoryMock;
- public DeleteDatamodelTests(WebApplicationFactory factory) : base(factory)
+ public DeleteDatamodelTests(WebApplicationFactory factory) : base(factory)
{
_repositoryMock = new Mock();
}
@@ -40,7 +40,7 @@ public async Task Delete_Datamodel_Ok(string org, string repo, string modelPath)
using HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Delete, dataPathWithData);
- using HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.NoContent);
}
}
diff --git a/backend/tests/Designer.Tests/Controllers/DataModelsController/GetDatamodelsTests.cs b/backend/tests/Designer.Tests/Controllers/DataModelsController/GetDatamodelsTests.cs
index 9bc87ece4de..d71f79c658a 100644
--- a/backend/tests/Designer.Tests/Controllers/DataModelsController/GetDatamodelsTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/DataModelsController/GetDatamodelsTests.cs
@@ -10,10 +10,10 @@
namespace Designer.Tests.Controllers.DataModelsController;
-public class GetDatamodelsTests : DisagnerEndpointsTestsBase
+public class GetDatamodelsTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/datamodels";
- public GetDatamodelsTests(WebApplicationFactory factory) : base(factory)
+ public GetDatamodelsTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -25,7 +25,7 @@ public async Task GetDatamodels_NoInput_ShouldReturnAllModels(string org, string
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url);
- var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ var response = await HttpClient.SendAsync(httpRequestMessage);
var altinnCoreFiles = await response.Content.ReadAsAsync>();
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
diff --git a/backend/tests/Designer.Tests/Controllers/DataModelsController/GetTests.cs b/backend/tests/Designer.Tests/Controllers/DataModelsController/GetTests.cs
index 0d1c405656c..575837bf984 100644
--- a/backend/tests/Designer.Tests/Controllers/DataModelsController/GetTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/DataModelsController/GetTests.cs
@@ -9,10 +9,10 @@
namespace Designer.Tests.Controllers.DataModelsController;
-public class GetTests : DisagnerEndpointsTestsBase
+public class GetTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/datamodels";
- public GetTests(WebApplicationFactory factory) : base(factory)
+ public GetTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -24,7 +24,7 @@ public async Task GetDatamodel_ValidPath_ShouldReturnContent(string modelPath, s
string url = $"{VersionPrefix(org, repo)}/datamodel?modelPath={modelPath}";
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.OK);
}
}
diff --git a/backend/tests/Designer.Tests/Controllers/DataModelsController/GetXsdDatamodelsTests.cs b/backend/tests/Designer.Tests/Controllers/DataModelsController/GetXsdDatamodelsTests.cs
index f1ded858047..4d937f6116b 100644
--- a/backend/tests/Designer.Tests/Controllers/DataModelsController/GetXsdDatamodelsTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/DataModelsController/GetXsdDatamodelsTests.cs
@@ -11,10 +11,10 @@
namespace Designer.Tests.Controllers.DataModelsController;
-public class GetXsdDatamodelsTests : DisagnerEndpointsTestsBase
+public class GetXsdDatamodelsTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/datamodels";
- public GetXsdDatamodelsTests(WebApplicationFactory factory) : base(factory)
+ public GetXsdDatamodelsTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -26,7 +26,7 @@ public async Task GetXsdDatamodels_NoInput_ShouldReturnAllModels(string org, str
var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url);
- var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ var response = await HttpClient.SendAsync(httpRequestMessage);
var altinnCoreFiles = await response.Content.ReadAsAsync>();
response.StatusCode.Should().Be(HttpStatusCode.OK);
diff --git a/backend/tests/Designer.Tests/Controllers/DataModelsController/NonAuthenticatedCallsTests.cs b/backend/tests/Designer.Tests/Controllers/DataModelsController/NonAuthenticatedCallsTests.cs
index 5b61e3a79a6..7be531de64e 100644
--- a/backend/tests/Designer.Tests/Controllers/DataModelsController/NonAuthenticatedCallsTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/DataModelsController/NonAuthenticatedCallsTests.cs
@@ -10,12 +10,12 @@
namespace Designer.Tests.Controllers.DataModelsController;
-public class NonAuthenticatedCallsTests : DisagnerEndpointsTestsBase
+public class NonAuthenticatedCallsTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/datamodels";
- private readonly WebApplicationFactory _factory;
+ private readonly WebApplicationFactory _factory;
- public NonAuthenticatedCallsTests(WebApplicationFactory factory) : base(factory)
+ public NonAuthenticatedCallsTests(WebApplicationFactory factory) : base(factory)
{
_factory = factory;
}
@@ -27,7 +27,7 @@ public async Task GetDatamodels_NotAuthenticated_ShouldReturn401(string org, str
string url = $"{VersionPrefix(org, repo)}/datamodel";
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
Assert.Equal(HttpStatusCode.Found, response.StatusCode);
Assert.Contains("/login/", response.Headers.Location.AbsoluteUri.ToLower());
diff --git a/backend/tests/Designer.Tests/Controllers/DataModelsController/PostTests.cs b/backend/tests/Designer.Tests/Controllers/DataModelsController/PostTests.cs
index 74b09ab3dcb..0e9b9610015 100644
--- a/backend/tests/Designer.Tests/Controllers/DataModelsController/PostTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/DataModelsController/PostTests.cs
@@ -13,10 +13,10 @@
namespace Designer.Tests.Controllers.DataModelsController;
-public class PostTests : DisagnerEndpointsTestsBase
+public class PostTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/datamodels";
- public PostTests(WebApplicationFactory factory) : base(factory)
+ public PostTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -39,7 +39,7 @@ public async Task PostDatamodel_FromFormPost_ShouldReturnCreatedFromTemplate(str
Content = JsonContent.Create(createViewModel, null, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase })
};
- using var postResponse = await HttpClient.Value.SendAsync(postRequestMessage);
+ using var postResponse = await HttpClient.SendAsync(postRequestMessage);
Assert.Equal(HttpStatusCode.Created, postResponse.StatusCode);
Assert.Equal("application/json", postResponse.Content.Headers.ContentType.MediaType);
@@ -52,7 +52,7 @@ public async Task PostDatamodel_FromFormPost_ShouldReturnCreatedFromTemplate(str
// at the location provided in the post response
var location = postResponse.Headers.Location;
using var getRequestMessage = new HttpRequestMessage(HttpMethod.Get, location);
- using var getResponse = await HttpClient.Value.SendAsync(getRequestMessage);
+ using var getResponse = await HttpClient.SendAsync(getRequestMessage);
string getContent = await getResponse.Content.ReadAsStringAsync();
var getJsonSchema = JsonSchema.FromText(getContent);
Assert.NotNull(getJsonSchema);
@@ -77,7 +77,7 @@ public async Task PostDatamodel_InvalidFormPost_ShouldReturnBadRequest(string mo
Content = JsonContent.Create(createViewModel, null, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase })
};
- var postResponse = await HttpClient.Value.SendAsync(postRequestMessage);
+ var postResponse = await HttpClient.SendAsync(postRequestMessage);
Assert.Equal(HttpStatusCode.BadRequest, postResponse.StatusCode);
}
diff --git a/backend/tests/Designer.Tests/Controllers/DataModelsController/PutDatamodelTests.cs b/backend/tests/Designer.Tests/Controllers/DataModelsController/PutDatamodelTests.cs
index 72c1ee01f6e..6c596c12db1 100644
--- a/backend/tests/Designer.Tests/Controllers/DataModelsController/PutDatamodelTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/DataModelsController/PutDatamodelTests.cs
@@ -31,14 +31,14 @@
namespace Designer.Tests.Controllers.DataModelsController;
-public class PutDatamodelTests : DisagnerEndpointsTestsBase
+public class PutDatamodelTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/datamodels";
private string TargetTestRepository { get; }
private const string MinimumValidJsonSchema = "{\"$schema\":\"https://json-schema.org/draft/2020-12/schema\",\"$id\":\"schema.json\",\"type\":\"object\",\"properties\":{\"root\":{\"$ref\":\"#/$defs/rootType\"}},\"$defs\":{\"rootType\":{\"properties\":{\"keyword\":{\"type\":\"string\"}}}}}";
- public PutDatamodelTests(WebApplicationFactory factory) : base(factory)
+ public PutDatamodelTests(WebApplicationFactory factory) : base(factory)
{
TargetTestRepository = TestDataHelper.GenerateTestRepoName();
}
@@ -61,7 +61,7 @@ public async Task ValidInput_ShouldReturn_NoContent_And_Create_Files(string mode
Content = new StringContent(MinimumValidJsonSchema, Encoding.UTF8, MediaTypeNames.Application.Json)
};
- var response = await HttpClient.Value.SendAsync(request);
+ var response = await HttpClient.SendAsync(request);
response.StatusCode.Should().Be(HttpStatusCode.NoContent);
await FilesWithCorrectNameAndContentShouldBeCreated(modelName);
}
@@ -80,7 +80,7 @@ public async Task ValidSchema_ShouldReturn_NoContent_And_Create_Files(string mod
Content = new StringContent(schema, Encoding.UTF8, MediaTypeNames.Application.Json)
};
- var response = await HttpClient.Value.SendAsync(request);
+ var response = await HttpClient.SendAsync(request);
response.StatusCode.Should().Be(HttpStatusCode.NoContent);
}
@@ -98,7 +98,7 @@ public async Task IncompatibleSchema_ShouldReturn422(string modelPath, string sc
Content = new StringContent(schema, Encoding.UTF8, MediaTypeNames.Application.Json)
};
- var response = await HttpClient.Value.SendAsync(request);
+ var response = await HttpClient.SendAsync(request);
response.StatusCode.Should().Be(HttpStatusCode.UnprocessableEntity);
string content = await response.Content.ReadAsStringAsync();
diff --git a/backend/tests/Designer.Tests/Controllers/DataModelsController/UseXsdFromRepoTests.cs b/backend/tests/Designer.Tests/Controllers/DataModelsController/UseXsdFromRepoTests.cs
index 899c60ed17e..a40bf073be5 100644
--- a/backend/tests/Designer.Tests/Controllers/DataModelsController/UseXsdFromRepoTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/DataModelsController/UseXsdFromRepoTests.cs
@@ -10,10 +10,10 @@
namespace Designer.Tests.Controllers.DataModelsController;
-public class UseXsdFromRepoTests : DisagnerEndpointsTestsBase
+public class UseXsdFromRepoTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/datamodels";
- public UseXsdFromRepoTests(WebApplicationFactory factory) : base(factory)
+ public UseXsdFromRepoTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -29,7 +29,7 @@ public async Task UseXsdFromRepo_DatamodelsRepo_ShouldReturnCreated(string org,
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, url);
- using var response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ using var response = await HttpClient.SendAsync(httpRequestMessage);
response.StatusCode.Should().Be(HttpStatusCode.Created);
}
}
diff --git a/backend/tests/Designer.Tests/Controllers/DeploymentsController/GetDeploymentsTests.cs b/backend/tests/Designer.Tests/Controllers/DeploymentsController/GetDeploymentsTests.cs
index 5316c0cb42c..7ad7cae4747 100644
--- a/backend/tests/Designer.Tests/Controllers/DeploymentsController/GetDeploymentsTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/DeploymentsController/GetDeploymentsTests.cs
@@ -6,7 +6,6 @@
using System.Text.Json;
using System.Threading.Tasks;
using Altinn.Studio.Designer.Configuration;
-using Altinn.Studio.Designer.Controllers;
using Altinn.Studio.Designer.Repository.Models;
using Altinn.Studio.Designer.Services.Interfaces;
using Altinn.Studio.Designer.TypedHttpClients.AzureDevOps.Enums;
@@ -19,11 +18,13 @@
using Moq;
using Xunit;
-public class GetDeployments : DisagnerEndpointsTestsBase
+namespace Designer.Tests.Controllers.DeploymentsController;
+
+public class GetDeployments : DisagnerEndpointsTestsBase, IClassFixture>
{
private readonly Mock _deploymentServiceMock = new Mock();
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/deployments";
- public GetDeployments(WebApplicationFactory factory) : base(factory)
+ public GetDeployments(WebApplicationFactory factory) : base(factory)
{
}
@@ -50,7 +51,7 @@ public async Task GetDeployments_NoLaggingDeployments_PipelineServiceNotCalled(s
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, uri);
// Act
- HttpResponseMessage res = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage res = await HttpClient.SendAsync(httpRequestMessage);
string responseString = await res.Content.ReadAsStringAsync();
SearchResults searchResult = JsonSerializer.Deserialize>(responseString, JsonSerializerOptions);
IEnumerable actual = searchResult.Results;
@@ -82,7 +83,7 @@ public async Task GetDeployments_SingleLaggingDeployments_PipelineServiceCalled(
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, uri);
// Act
- HttpResponseMessage res = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage res = await HttpClient.SendAsync(httpRequestMessage);
string responseString = await res.Content.ReadAsStringAsync();
SearchResults searchResult = JsonSerializer.Deserialize>(responseString, JsonSerializerOptions);
IEnumerable actual = searchResult.Results;
diff --git a/backend/tests/Designer.Tests/Controllers/DeploymentsController/GetPermissionsTests.cs b/backend/tests/Designer.Tests/Controllers/DeploymentsController/GetPermissionsTests.cs
index 2534cb7e49c..7ccbd86473d 100644
--- a/backend/tests/Designer.Tests/Controllers/DeploymentsController/GetPermissionsTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/DeploymentsController/GetPermissionsTests.cs
@@ -3,7 +3,6 @@
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
-using Altinn.Studio.Designer.Controllers;
using Altinn.Studio.Designer.RepositoryClient.Model;
using Altinn.Studio.Designer.Services.Interfaces;
using Designer.Tests.Controllers.ApiTests;
@@ -12,12 +11,14 @@
using Moq;
using Xunit;
-public class GetPermissions : DisagnerEndpointsTestsBase
+namespace Designer.Tests.Controllers.DeploymentsController;
+
+public class GetPermissions : DisagnerEndpointsTestsBase, IClassFixture>
{
private static string VersionPrefix(string org, string repository) => $"/designer/api/{org}/{repository}/deployments";
private readonly Mock _giteaMock;
- public GetPermissions(WebApplicationFactory factory) : base(factory)
+ public GetPermissions(WebApplicationFactory factory) : base(factory)
{
_giteaMock = new Mock();
_giteaMock.Setup(g => g.GetUserNameFromUI()).ReturnsAsync("testUser");
@@ -45,7 +46,7 @@ public async Task GetPermissions_ToDeploymentsEnvironments_UserHasTeam_ReturnTea
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, uri);
// Act
- HttpResponseMessage res = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage res = await HttpClient.SendAsync(httpRequestMessage);
string responseString = await res.Content.ReadAsStringAsync();
List permittedEnvironments = JsonSerializer.Deserialize>(responseString, JsonSerializerOptions);
@@ -68,7 +69,7 @@ public async Task GetPermissions_ToDeploymentsEnvironments_UserHasNoTeam_ReturnE
using var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, uri);
// Act
- HttpResponseMessage res = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage res = await HttpClient.SendAsync(httpRequestMessage);
string responseString = await res.Content.ReadAsStringAsync();
List permittedEnvironments = JsonSerializer.Deserialize>(responseString, JsonSerializerOptions);
diff --git a/backend/tests/Designer.Tests/Controllers/LanguagesController/GetLanguagesTests.cs b/backend/tests/Designer.Tests/Controllers/LanguagesController/GetLanguagesTests.cs
index 1c08fcce06b..3ea12406d08 100644
--- a/backend/tests/Designer.Tests/Controllers/LanguagesController/GetLanguagesTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/LanguagesController/GetLanguagesTests.cs
@@ -9,11 +9,11 @@
namespace Designer.Tests.Controllers.LanguagesController
{
- public class GetLanguagesTests : DisagnerEndpointsTestsBase
+ public class GetLanguagesTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private readonly string _versionPrefix = "designer/api";
- public GetLanguagesTests(WebApplicationFactory factory) : base(factory)
+ public GetLanguagesTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -23,7 +23,7 @@ public async Task GetLanguages_ReturnsNnAndNb()
string dataPathWithData = $"{_versionPrefix}/ttd/new-texts-format/languages";
HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, dataPathWithData);
- HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
string responseBody = await response.Content.ReadAsStringAsync();
JsonDocument responseDocument = JsonDocument.Parse(responseBody);
diff --git a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetActionOptionsTests.cs b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetActionOptionsTests.cs
index 94ee13a4f26..fead37e6809 100644
--- a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetActionOptionsTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetActionOptionsTests.cs
@@ -11,11 +11,11 @@
namespace Designer.Tests.Controllers.PolicyControllerTests
{
- public class GetActionOptionsTests : DisagnerEndpointsTestsBase
+ public class GetActionOptionsTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private readonly string _versionPrefix = "designer/api";
- public GetActionOptionsTests(WebApplicationFactory factory) : base(factory)
+ public GetActionOptionsTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -30,7 +30,7 @@ public async Task Get_ActionOptions()
using (HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, dataPathWithData))
{
- HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
actionOptions = System.Text.Json.JsonSerializer.Deserialize>(responseBody, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
diff --git a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetAppPolicyTests.cs b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetAppPolicyTests.cs
index 0181f13303b..69b1e556a70 100644
--- a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetAppPolicyTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetAppPolicyTests.cs
@@ -10,11 +10,11 @@
namespace Designer.Tests.Controllers.PolicyControllerTests
{
- public class GetAppPolicyTests : DisagnerEndpointsTestsBase
+ public class GetAppPolicyTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private readonly string _versionPrefix = "designer/api";
- public GetAppPolicyTests(WebApplicationFactory factory) : base(factory)
+ public GetAppPolicyTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -28,7 +28,7 @@ public async Task GetApp_AppPolicyOk()
string dataPathWithData = $"{_versionPrefix}/ttd/{targetRepository}/policy";
using (HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, dataPathWithData))
{
- HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
resourcePolicy = System.Text.Json.JsonSerializer.Deserialize(responseBody, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
diff --git a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetResourcePolicyTests.cs b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetResourcePolicyTests.cs
index 854a92517e1..a1d0bc78371 100644
--- a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetResourcePolicyTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetResourcePolicyTests.cs
@@ -10,11 +10,11 @@
namespace Designer.Tests.Controllers.PolicyControllerTests
{
- public class GetResourcePolicyTests : DisagnerEndpointsTestsBase
+ public class GetResourcePolicyTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private readonly string _versionPrefix = "designer/api";
- public GetResourcePolicyTests(WebApplicationFactory factory) : base(factory)
+ public GetResourcePolicyTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -29,7 +29,7 @@ public async Task Get_ResourcePolicyOk()
ResourcePolicy resourcePolicy;
using (HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, dataPathWithData))
{
- HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
resourcePolicy = System.Text.Json.JsonSerializer.Deserialize(responseBody, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
diff --git a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetSubjectOptionsTests.cs b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetSubjectOptionsTests.cs
index 98cf98b61e6..e55971d4fd0 100644
--- a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetSubjectOptionsTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/GetSubjectOptionsTests.cs
@@ -11,11 +11,11 @@
namespace Designer.Tests.Controllers.PolicyControllerTests
{
- public class GetSubjectOptionsTests : DisagnerEndpointsTestsBase
+ public class GetSubjectOptionsTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private readonly string _versionPrefix = "designer/api";
- public GetSubjectOptionsTests(WebApplicationFactory factory) : base(factory)
+ public GetSubjectOptionsTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -29,7 +29,7 @@ public async Task Get_SubjectOptions()
List subjectionOptions;
using (HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, dataPathWithData))
{
- HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
diff --git a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/UpdateApplicationPolicyTests.cs b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/UpdateApplicationPolicyTests.cs
index e2dc9c242b1..b409c210921 100644
--- a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/UpdateApplicationPolicyTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/UpdateApplicationPolicyTests.cs
@@ -11,11 +11,11 @@
namespace Designer.Tests.Controllers.PolicyControllerTests
{
- public class UpdateApplicationPolicyTests : DisagnerEndpointsTestsBase
+ public class UpdateApplicationPolicyTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private readonly string _versionPrefix = "designer/api";
- public UpdateApplicationPolicyTests(WebApplicationFactory factory) : base(factory)
+ public UpdateApplicationPolicyTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -33,7 +33,7 @@ public async Task Update_AppPolicyOk()
{
httpRequestMessage.Content = new StringContent(JsonConvert.SerializeObject(resourcePolicy), Encoding.UTF8, "application/json");
- HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
responseBody = await response.Content.ReadAsStringAsync();
}
@@ -54,7 +54,7 @@ public async Task Create_ResourcePolicyOk()
using (HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Post, dataPathWithData))
{
httpRequestMessage.Content = new StringContent(JsonConvert.SerializeObject(resourcePolicy), Encoding.UTF8, "application/json");
- HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
responseBody = await response.Content.ReadAsStringAsync();
}
diff --git a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/UpdateResourcePolicyTests.cs b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/UpdateResourcePolicyTests.cs
index 55c74c0632d..daa92e943c0 100644
--- a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/UpdateResourcePolicyTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/UpdateResourcePolicyTests.cs
@@ -11,11 +11,11 @@
namespace Designer.Tests.Controllers.PolicyControllerTests
{
- public class UpdateResourcePolicyTests : DisagnerEndpointsTestsBase
+ public class UpdateResourcePolicyTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private readonly string _versionPrefix = "designer/api";
- public UpdateResourcePolicyTests(WebApplicationFactory factory) : base(factory)
+ public UpdateResourcePolicyTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -32,7 +32,7 @@ public async Task Update_ResourcePolicyOk()
using (HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Put, dataPathWithData))
{
httpRequestMessage.Content = new StringContent(JsonConvert.SerializeObject(resourcePolicy), Encoding.UTF8, "application/json");
- HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
responseBody = await response.Content.ReadAsStringAsync();
}
diff --git a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/ValidateAppPolicyTests.cs b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/ValidateAppPolicyTests.cs
index cf7069592a7..ab71d45580a 100644
--- a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/ValidateAppPolicyTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/ValidateAppPolicyTests.cs
@@ -14,11 +14,11 @@
namespace Designer.Tests.Controllers.PolicyControllerTests
{
- public class ValidateAppPolicyTests : DisagnerEndpointsTestsBase
+ public class ValidateAppPolicyTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private readonly string _versionPrefix = "designer/api";
- public ValidateAppPolicyTests(WebApplicationFactory factory) : base(factory)
+ public ValidateAppPolicyTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -33,7 +33,7 @@ public async Task Validate_AppPolicyOk()
ValidationProblemDetails validationDetails;
using (HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, dataPathWithData))
{
- HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
validationDetails = System.Text.Json.JsonSerializer.Deserialize(responseBody, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
@@ -53,7 +53,7 @@ public async Task Validate_AppPolicyMissingSubject()
ResourcePolicy resourcePolicy;
using (HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, dataPathWithData))
{
- HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
resourcePolicy = System.Text.Json.JsonSerializer.Deserialize(responseBody, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
@@ -68,7 +68,7 @@ public async Task Validate_AppPolicyMissingSubject()
httpRequestMessage2.Content = new StringContent(JsonConvert.SerializeObject(resourcePolicy), Encoding.UTF8, "application/json");
- HttpResponseMessage response2 = await HttpClient.Value.SendAsync(httpRequestMessage2);
+ HttpResponseMessage response2 = await HttpClient.SendAsync(httpRequestMessage2);
response2.EnsureSuccessStatusCode();
}
@@ -77,7 +77,7 @@ public async Task Validate_AppPolicyMissingSubject()
ValidationProblemDetails validationDetails;
using (HttpRequestMessage httpRequestMessage3 = new HttpRequestMessage(HttpMethod.Get, dataPathWithData3))
{
- HttpResponseMessage response3 = await HttpClient.Value.SendAsync(httpRequestMessage3);
+ HttpResponseMessage response3 = await HttpClient.SendAsync(httpRequestMessage3);
string responseBody3 = await response3.Content.ReadAsStringAsync();
validationDetails = System.Text.Json.JsonSerializer.Deserialize(responseBody3, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
}
diff --git a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/ValidateResourcePolicyTests.cs b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/ValidateResourcePolicyTests.cs
index 55fd09061dc..d18c99da8f3 100644
--- a/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/ValidateResourcePolicyTests.cs
+++ b/backend/tests/Designer.Tests/Controllers/PolicyControllerTests/ValidateResourcePolicyTests.cs
@@ -15,11 +15,11 @@
namespace Designer.Tests.Controllers.PolicyControllerTests
{
- public class ValidateResourcePolicyTests : DisagnerEndpointsTestsBase
+ public class ValidateResourcePolicyTests : DisagnerEndpointsTestsBase, IClassFixture>
{
private readonly string _versionPrefix = "designer/api";
- public ValidateResourcePolicyTests(WebApplicationFactory factory) : base(factory)
+ public ValidateResourcePolicyTests(WebApplicationFactory factory) : base(factory)
{
}
@@ -34,7 +34,7 @@ public async Task Validate_ResourcePolicyOk()
ValidationProblemDetails validationDetails;
using (HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, dataPathWithData))
{
- HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
validationDetails = System.Text.Json.JsonSerializer.Deserialize(responseBody, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
@@ -53,7 +53,7 @@ public async Task Validate_ResourcePolicyMissingSubject()
ResourcePolicy resourcePolicy;
using (HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, dataPathWithData))
{
- HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
resourcePolicy = System.Text.Json.JsonSerializer.Deserialize(responseBody, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
@@ -66,7 +66,7 @@ public async Task Validate_ResourcePolicyMissingSubject()
using (HttpRequestMessage httpRequestMessage2 = new HttpRequestMessage(HttpMethod.Put, dataPathWithData2))
{
httpRequestMessage2.Content = new StringContent(JsonConvert.SerializeObject(resourcePolicy), Encoding.UTF8, "application/json");
- HttpResponseMessage response2 = await HttpClient.Value.SendAsync(httpRequestMessage2);
+ HttpResponseMessage response2 = await HttpClient.SendAsync(httpRequestMessage2);
response2.EnsureSuccessStatusCode();
}
@@ -75,7 +75,7 @@ public async Task Validate_ResourcePolicyMissingSubject()
ValidationProblemDetails validationDetails;
using (HttpRequestMessage httpRequestMessage3 = new HttpRequestMessage(HttpMethod.Get, dataPathWithData3))
{
- HttpResponseMessage response3 = await HttpClient.Value.SendAsync(httpRequestMessage3);
+ HttpResponseMessage response3 = await HttpClient.SendAsync(httpRequestMessage3);
string responseBody3 = await response3.Content.ReadAsStringAsync();
validationDetails = System.Text.Json.JsonSerializer.Deserialize(responseBody3, new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase });
}
@@ -96,7 +96,7 @@ public async Task Validate_ResourcePolicyMissingRules()
ResourcePolicy resourcePolicy;
using (HttpRequestMessage httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, dataPathWithData))
{
- HttpResponseMessage response = await HttpClient.Value.SendAsync(httpRequestMessage);
+ HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
resourcePolicy = System.Text.Json.JsonSerializer.Deserialize