Compare commits

..

5 Commits

Author SHA1 Message Date
Jedd Morgan 5c40a74f6d fake a release
.NET Build and Publish / build (push) Has been cancelled
2025-12-02 14:45:58 +00:00
Jedd Morgan 21c5a2e163 Fixes 2025-12-02 14:25:17 +00:00
Jedd Morgan 34aa4f3548 subscriptions 2025-12-02 14:24:50 +00:00
Jedd Morgan 3fbd9c17ba format
.NET Build and Publish / build (push) Has been cancelled
2025-11-24 18:41:10 +00:00
Jedd Morgan 937eb94730 First pass 2025-11-24 18:40:17 +00:00
59 changed files with 133 additions and 576 deletions
+5 -14
View File
@@ -6,12 +6,10 @@ on:
docker-compose-file:
required: true
type: string
use-internal-image:
use-github-container-registry:
default: false
type: boolean
secrets:
CODECOV_TOKEN:
required: true
jobs:
integration-test:
env:
@@ -19,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
@@ -29,7 +27,7 @@ jobs:
cache-dependency-path: "**/packages.lock.json"
- name: 🔐 Login to Github Container Registry
if: ${{ inputs.use-internal-image }}
if: ${{ inputs.use-github-container-registry }}
uses: docker/login-action@v3
with:
registry: "ghcr.io"
@@ -45,18 +43,11 @@ jobs:
- name: 🏗️ Build
run: dotnet build ${{ env.Solution }} --configuration Release --no-restore -warnaserror
- name: 🔨 Integration Tests against Public Server
if: ${{ !inputs.use-internal-image }}
run: dotnet test ${{ env.Solution }} --filter "(Category=Integration)&(Server!=Internal)" --configuration Release --no-build --no-restore --verbosity=normal /p:AltCover=true /p:AltCoverAttributeFilter=ExcludeFromCodeCoverage
- name: 🔨 Integration Tests against Internal Server
if: ${{ inputs.use-internal-image }}
- name: 🔨 Integration Tests
run: dotnet test ${{ env.Solution }} --filter "Category=Integration" --configuration Release --no-build --no-restore --verbosity=normal /p:AltCover=true /p:AltCoverAttributeFilter=ExcludeFromCodeCoverage
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
continue-on-error: true
with:
fail_ci_if_error: true
files: tests/**/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
+3 -9
View File
@@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
@@ -39,9 +39,7 @@ jobs:
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
continue-on-error: true
with:
fail_ci_if_error: true
files: tests/**/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
@@ -49,13 +47,9 @@ jobs:
uses: "./.github/workflows/integration-test.yml"
with:
docker-compose-file: "docker-compose-internal.yml"
use-internal-image: true
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
use-github-container-registry: true
integration-test-public:
uses: "./.github/workflows/integration-test.yml"
with:
docker-compose-file: "docker-compose.yml"
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+1 -3
View File
@@ -14,7 +14,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
@@ -48,9 +48,7 @@ jobs:
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
continue-on-error: true
with:
fail_ci_if_error: true
files: tests/**/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
-1
View File
@@ -1 +0,0 @@
dotnet 8.0.400
-2
View File
@@ -10,7 +10,6 @@
<File Path="Directory.Build.props" />
<File Path="Directory.Build.Targets" />
<File Path="Directory.Packages.props" />
<File Path="docker-compose-internal.yml" />
<File Path="docker-compose.yml" />
<File Path="global.json" />
<File Path="README.md" />
@@ -18,7 +17,6 @@
<File Path=".github\git-commit-instructions.md" />
</Folder>
<Folder Name="/config/workflows/">
<File Path=".github/workflows/integration-test.yml" />
<File Path=".github/workflows/pr.yml" />
<File Path=".github/workflows/release.yml" />
</Folder>
+1 -1
View File
@@ -180,6 +180,6 @@ Target(
}
);
Target("default", dependsOn: [FORMAT, TEST, INTEGRATION], () => Console.WriteLine("Done!"));
Target("default", dependsOn: [FORMAT, TEST], () => Console.WriteLine("Done!"));
await RunTargetsAndExitAsync(args).ConfigureAwait(true);
+4 -1
View File
@@ -97,7 +97,10 @@ services:
STRATEGY_LOCAL: "true"
POSTGRES_URL: 'postgres://speckle:speckle@postgres:5432/speckle'
POSTGRES_URL: "postgres"
POSTGRES_USER: "speckle"
POSTGRES_PASSWORD: "speckle"
POSTGRES_DB: "speckle"
ENABLE_MP: "false"
LOG_PRETTY: "true"
@@ -63,7 +63,7 @@ internal sealed class AutomationContext(IOperations operations) : IAutomationCon
);
}
Base rootObject = await operations
Base? rootObject = await operations
.Receive2(
SpeckleClient.ServerUrl,
AutomationRunData.ProjectId,
@@ -74,10 +74,6 @@ internal sealed class AutomationContext(IOperations operations) : IAutomationCon
)
.ConfigureAwait(false);
await SpeckleClient
.Version.Received(new(version.id, AutomationRunData.ProjectId, "automate_function"), cancellationToken)
.ConfigureAwait(false);
Console.WriteLine($"It took {Elapsed.TotalSeconds} seconds to receive the speckle version {versionId}");
return rootObject;
}
-6
View File
@@ -1,6 +0,0 @@
using Speckle.Sdk.Models;
namespace Speckle.Objects.Geometry;
[SpeckleType("Objects.Geometry.SolidX")]
public class SolidX : RawEncodedObject;
-2
View File
@@ -20,6 +20,4 @@ public class RawEncoding : Base // note: at this stage, since we're using this f
public static class RawEncodingFormats
{
public const string RHINO_3DM = "3dm";
public const string ACAD_DWG = "dwg";
public const string ACAD_SAT = "sat";
}
@@ -2,10 +2,8 @@
public record GenerateFileUploadUrlInput(string projectId, string fileName);
[Obsolete(FileImportInputBase.FILE_IMPORT_DEPRECATION_MESSAGE)]
public record StartFileImportInput(string projectId, string modelId, string fileId, string etag);
[Obsolete(FileImportInputBase.FILE_IMPORT_DEPRECATION_MESSAGE)]
public record FileImportResult(
double durationSeconds,
double downloadDurationSeconds,
@@ -16,23 +14,14 @@ public record FileImportResult(
public abstract class FileImportInputBase
{
internal const string FILE_IMPORT_DEPRECATION_MESSAGE =
"Part of the old API surface and will be removed in the future. Use the new ingestion API instead. Field will be deleted on June 1st, 2026";
[Obsolete(FileImportInputBase.FILE_IMPORT_DEPRECATION_MESSAGE)]
protected FileImportInputBase() { }
public required string projectId { get; init; }
public required string jobId { get; init; }
public required IReadOnlyCollection<string> warnings { get; init; }
[Obsolete(FileImportInputBase.FILE_IMPORT_DEPRECATION_MESSAGE)]
public required FileImportResult result { get; init; }
}
#pragma warning disable CA1822 //Mark members as static
[Obsolete(FILE_IMPORT_DEPRECATION_MESSAGE)]
public sealed class FileImportSuccessInput() : FileImportInputBase()
{
public const string TYPE_STATUS = "success";
@@ -40,7 +29,6 @@ public sealed class FileImportSuccessInput() : FileImportInputBase()
public string status => TYPE_STATUS;
}
[Obsolete(FILE_IMPORT_DEPRECATION_MESSAGE)]
public sealed class FileImportErrorInput() : FileImportInputBase()
{
public const string TYPE_STATUS = "error";
@@ -1,5 +1,4 @@
using Speckle.Newtonsoft.Json;
using Speckle.Sdk.Api.GraphQL.Enums;
using Speckle.Sdk.Api.GraphQL.Enums;
namespace Speckle.Sdk.Api.GraphQL.Inputs;
@@ -19,12 +18,7 @@ public record ModelIngestionCreateInput(
public record ModelIngestionUpdateInput(string ingestionId, string projectId, string progressMessage, double? progress);
public record ModelIngestionSuccessInput(
string ingestionId,
string projectId,
string rootObjectId,
string? versionMessage
);
public record ModelIngestionSuccessInput(string ingestionId, string projectId, string rootObjectId);
public record ModelIngestionFailedInput(
string ingestionId,
@@ -41,26 +35,11 @@ public record ModelIngestionFailedInput(
public record ModelIngestionCancelledInput(string ingestionId, string projectId, string cancellationMessage);
public record ModelIngestionStartProcessingInput(
string ingestionId,
string projectId,
string progressMessage,
SourceDataInput sourceData
);
public record ModelIngestionRequeueInput(string ingestionId, string projectId, string progressMessage);
public record ProjectModelIngestionSubscriptionInput(
string projectId,
ModelIngestionReference ingestionReference,
[property: JsonIgnore] ProjectModelIngestionUpdatedMessageType messageType
)
{
// The Newtonsoft serializer is setup to handle SCREAMING_CASE enums.
// But the API requires the enum to look exactly like they are
[JsonProperty(nameof(messageType))]
public string serializedType => messageType.ToString();
}
ProjectModelIngestionUpdatedMessageType messageType
);
/// <remarks>
/// <c>@oneOf</c> i.e. server expects <b>either</b> <paramref name="ingestionId"/> or <paramref name="modelId"/>, but not both.
@@ -1,6 +1,4 @@
using Version = Speckle.Sdk.Api.GraphQL.Models.Version;
namespace Speckle.Sdk.Api.GraphQL.Inputs;
namespace Speckle.Sdk.Api.GraphQL.Inputs;
public record UpdateVersionInput(string versionId, string projectId, string? message);
@@ -18,10 +16,6 @@ public record CreateVersionInput(
IReadOnlyList<string>? parents = null
);
/// <param name="versionId"></param>
/// <param name="projectId"></param>
/// <param name="sourceApplication">IMPORTANT: this is meant to be the slug of the application that has done the receiving, not to be confused with <see cref="Version.sourceApplication"/></param>
/// <param name="message"></param>
public record MarkReceivedVersionInput(
string versionId,
string projectId,
@@ -1,8 +0,0 @@
namespace Speckle.Sdk.Api.GraphQL.Models;
public sealed class ModelPermissionChecks
{
public PermissionCheckResult canUpdate { get; init; }
public PermissionCheckResult canDelete { get; init; }
public PermissionCheckResult canCreateVersion { get; init; }
}
@@ -10,7 +10,7 @@ public sealed class PendingStreamCollaborator
public string projectName { get; init; }
public string title { get; init; }
public string role { get; init; }
public LimitedUser? invitedBy { get; init; }
public LimitedUser invitedBy { get; init; }
public LimitedUser? user { get; init; }
public string? token { get; init; }
}
@@ -5,7 +5,5 @@ public sealed class ProjectPermissionChecks
public PermissionCheckResult canCreateModel { get; init; }
public PermissionCheckResult canDelete { get; init; }
public PermissionCheckResult canLoad { get; init; }
[Obsolete("Use ModelPermissionChecks.CanCreateVersion instead", true)]
public PermissionCheckResult canPublish { get; init; }
}
@@ -397,6 +397,11 @@ public sealed class ActiveUserResource
authorized
message
}
canPublish {
code
authorized
message
}
}
}
}
@@ -29,10 +29,8 @@ public sealed class FileImportResource : IDisposable
/// <remarks>
/// Only use this if you are writing a file importer, that is responsible for
/// processing file import jobs.
/// Only works on servers version >=2.25.8 but from 3.0.7 onwards has been deprecated and replaced by model ingestion api
/// see <see cref="ModelIngestionResource.Complete"/>
/// Only works on servers version >=2.25.8
/// </remarks>
[Obsolete(FileImportInputBase.FILE_IMPORT_DEPRECATION_MESSAGE)]
public async Task<bool> FinishFileImportJob(FileImportInputBase input, CancellationToken cancellationToken)
{
//language=graphql
@@ -59,11 +57,7 @@ public sealed class FileImportResource : IDisposable
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <inheritdoc cref="ISpeckleGraphQLClient.ExecuteGraphQLRequest{T}"/>
/// <remarks>
/// Only works on servers version >=2.25.8 but from 3.0.7 onwards has been deprecated and replaced by model ingestion api
/// see <see cref="ModelIngestionResource.StartProcessing"/>
/// </remarks>
[Obsolete(FileImportInputBase.FILE_IMPORT_DEPRECATION_MESSAGE)]
/// <remarks>Only works on servers version >=2.25.8</remarks>
public async Task<FileImport> StartFileImportJob(
StartFileImportInput input,
CancellationToken cancellationToken = default
@@ -5,9 +5,6 @@ using Speckle.Sdk.Api.GraphQL.Models.Responses;
namespace Speckle.Sdk.Api.GraphQL.Resources;
/// <remarks>
/// Model Ingestion API is available for server versions <c>3.0.3-alpha.583</c> and above
/// </remarks>
public sealed class ModelIngestionResource
{
private readonly ISpeckleGraphQLClient _client;
@@ -17,14 +14,6 @@ public sealed class ModelIngestionResource
_client = client;
}
/// <summary>
/// Create a new model ingestion
/// </summary>
/// <remarks>
/// The model ingestion created will have a <c>processing</c> state (not <c>queued</c>). This mutation is designed to be used
/// by client/connectors that are immediately processing
/// Model Ingestion API is available for server versions <c>3.0.3-alpha.583</c> and above
/// </remarks>
/// <param name="input"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
@@ -71,159 +60,6 @@ public sealed class ModelIngestionResource
return res.data.data.data;
}
/// <remarks>
/// Model Ingestion API is available for server versions <c>3.0.3-alpha.583</c> and above
/// </remarks>
/// <param name="modelIngestionId"></param>
/// <param name="projectId"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <inheritdoc cref="ISpeckleGraphQLClient.ExecuteGraphQLRequest{T}"/>
public async Task<ModelIngestion> Get(
string modelIngestionId,
string projectId,
CancellationToken cancellationToken = default
)
{
//language=graphql
const string QUERY = """
query Query($projectId: String!, $modelIngestionId: ID!) {
data:project(id: $projectId) {
data:ingestion(id: $modelIngestionId) {
id
createdAt
updatedAt
modelId
cancellationRequested
statusData {
... on HasModelIngestionStatus {
status
}
... on HasProgressMessage {
progressMessage
}
}
}
}
}
""";
GraphQLRequest request = new() { Query = QUERY, Variables = new { projectId, modelIngestionId } };
var res = await _client
.ExecuteGraphQLRequest<RequiredResponse<RequiredResponse<ModelIngestion>>>(request, cancellationToken)
.ConfigureAwait(false);
return res.data.data;
}
/// <summary>
/// For File Import / Cloud integrations only
/// </summary>
/// <remarks>
/// Model Ingestion API is available for server versions <c>3.0.3-alpha.583</c> and above
/// </remarks>
/// <param name="input"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <inheritdoc cref="ISpeckleGraphQLClient.ExecuteGraphQLRequest{T}"/>
public async Task<ModelIngestion> StartProcessing(
ModelIngestionStartProcessingInput input,
CancellationToken cancellationToken = default
)
{
//language=graphql
const string QUERY = """
mutation IngestionStartProcessing($input: ModelIngestionStartProcessingInput!) {
data: projectMutations {
data: modelIngestionMutations {
data: startProcessing(input: $input) {
id
createdAt
updatedAt
modelId
cancellationRequested
statusData {
... on HasModelIngestionStatus {
status
}
... on HasProgressMessage {
progressMessage
}
}
}
}
}
}
""";
GraphQLRequest request = new() { Query = QUERY, Variables = new { input } };
var res = await _client
.ExecuteGraphQLRequest<RequiredResponse<RequiredResponse<RequiredResponse<ModelIngestion>>>>(
request,
cancellationToken
)
.ConfigureAwait(false);
return res.data.data.data;
}
/// <summary>
/// For File Import / Cloud integrations only
/// </summary>
/// <remarks>
/// Model Ingestion API is available for server versions <c>3.0.3-alpha.583</c> and above
/// </remarks>
/// <param name="input"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <inheritdoc cref="ISpeckleGraphQLClient.ExecuteGraphQLRequest{T}"/>
public async Task<ModelIngestion> Requeue(
ModelIngestionRequeueInput input,
CancellationToken cancellationToken = default
)
{
//language=graphql
const string QUERY = """
mutation IngestionStartProcessing($input: ModelIngestionRequeueInput!) {
data: projectMutations {
data: modelIngestionMutations {
data: requeue(input: $input) {
id
createdAt
updatedAt
modelId
cancellationRequested
statusData {
... on HasModelIngestionStatus {
status
}
... on HasProgressMessage {
progressMessage
}
}
}
}
}
}
""";
GraphQLRequest request = new() { Query = QUERY, Variables = new { input } };
var res = await _client
.ExecuteGraphQLRequest<RequiredResponse<RequiredResponse<RequiredResponse<ModelIngestion>>>>(
request,
cancellationToken
)
.ConfigureAwait(false);
return res.data.data.data;
}
/// <remarks>
/// Model Ingestion API is available for server versions <c>3.0.3-alpha.583</c> and above
/// </remarks>
/// <param name="input"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
@@ -276,9 +112,6 @@ public sealed class ModelIngestionResource
/// Request that the server completes the ingestion by creating a version
/// If successful, the job will be in a terminal "successful" state.
/// </summary>
/// <remarks>
/// Model Ingestion API is available for server versions <c>3.0.3-alpha.583</c> and above
/// </remarks>
/// <seealso cref="FailWithError"/>
/// <seealso cref="FailWithCancel"/>
/// <param name="input"></param>
@@ -319,8 +152,7 @@ public sealed class ModelIngestionResource
/// Fail the job with an error.
/// </summary>
/// <remarks>
/// For requested user cancellation, use <see cref="FailWithCancel"/> instead<br/>
/// Model Ingestion API is available for server versions <c>3.0.3-alpha.583</c> and above
/// For requested user cancellation, use <see cref="FailWithCancel"/> instead
/// </remarks>
/// <seealso cref="FailWithCancel"/>
/// <seealso cref="Complete"/>
@@ -374,8 +206,7 @@ public sealed class ModelIngestionResource
/// Fail the ingestion with a <c>canceled</c> status.
/// This should only be done if the user has explicitly requested cancellation
/// Other forms of cancellation use <see cref="FailWithError"/>.
/// The ingestion should then enter a terminal "canceled" state.<br/>
/// Model Ingestion API is available for server versions <c>3.0.3-alpha.583</c> and above
/// The ingestion should then enter a terminal "canceled" state
/// </summary>
/// <seealso cref="FailWithError"/>
/// <seealso cref="Complete"/>
@@ -433,8 +264,7 @@ public sealed class ModelIngestionResource
/// It's up to the client to observe this cancellation request
/// via <see cref="SubscriptionResource.CreateProjectModelIngestionCancellationRequestedSubscription"/>
/// and report it as canceled via <see cref="ModelIngestionResource.FailWithCancel"/>
/// See "cooperative cancellation pattern"<br/>
/// Model Ingestion API is available for server versions <c>3.0.3-alpha.583</c> and above
/// See "cooperative cancellation pattern"
/// </remarks>
/// <seealso cref="FailWithError"/>
/// <seealso cref="Complete"/>
@@ -312,51 +312,4 @@ public sealed class ModelResource
return res.data.data;
}
/// <param name="projectId"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <inheritdoc cref="ISpeckleGraphQLClient.ExecuteGraphQLRequest{T}"/>
public async Task<ModelPermissionChecks> GetPermissions(
string projectId,
string modelId,
CancellationToken cancellationToken = default
)
{
//language=graphql
const string QUERY = """
query ModelPermissions($projectId: String!, $modelId: String!) {
data:project(id: $projectId) {
data:model(id: $modelId) {
data:permissions {
canUpdate {
authorized
code
message
}
canDelete {
authorized
code
message
}
canCreateVersion {
authorized
code
message
}
}
}
}
}
""";
GraphQLRequest request = new() { Query = QUERY, Variables = new { projectId, modelId } };
var response = await _client
.ExecuteGraphQLRequest<RequiredResponse<RequiredResponse<RequiredResponse<ModelPermissionChecks>>>>(
request,
cancellationToken
)
.ConfigureAwait(false);
return response.data.data.data;
}
}
@@ -222,22 +222,14 @@ public sealed class SubscriptionResource : IDisposable
{
//language=graphql
const string QUERY = """
subscription IngestionUpdated($input: ProjectModelIngestionSubscriptionInput!) {
subscription IngestionUpdated(
$input: ProjectModelIngestionSubscriptionInput!
) {
data: projectModelIngestionUpdated(input: $input) {
modelIngestion {
id
createdAt
updatedAt
modelId
cancellationRequested
statusData {
... on HasModelIngestionStatus {
status
}
... on HasProgressMessage {
progressMessage
}
}
}
type
}
@@ -1,2 +1,2 @@
schema: https://app.speckle.systems/graphql
schema: http://localhost/graphql
documents: '**/*.graphql'
+1 -16
View File
@@ -140,22 +140,7 @@ internal static class TypeLoader
return typeof(Base);
}
/// <summary>
/// For testing purposes only
/// </summary>
internal static void ReInitialize(params Assembly[] assemblies)
{
lock (s_availableTypes)
{
Reset();
Load(assemblies);
s_initialized = true;
}
}
/// <summary>
/// For testing purposes only
/// </summary>
//Don't use unless you're testing
public static void Reset()
{
s_availableTypes = new();
+1 -1
View File
@@ -1,2 +1,2 @@
schema: https://app.speckle.systems/graphql
schema: http://localhost/graphql
documents: '**/*.graphql'
@@ -184,7 +184,7 @@ public class SerializationTests
idToBase.Count.Should().Be(count);
}
[Theory(Skip = "Takes too long")]
[Theory]
[InlineData(1)]
[InlineData(4)]
public async Task Roundtrip_Test_New(int concurrency)
@@ -0,0 +1,8 @@
{
"Type": "AggregateException",
"InnerException": {
"Data": {},
"Message": "NOT_FOUND_ERROR: Model ingestion was not found",
"Type": "SpeckleGraphQLException"
}
}
@@ -0,0 +1,8 @@
{
"Type": "AggregateException",
"InnerException": {
"Data": {},
"Message": "STREAM_NOT_FOUND: Project not found",
"Type": "SpeckleGraphQLStreamNotFoundException"
}
}
@@ -0,0 +1,8 @@
{
"Type": "AggregateException",
"InnerException": {
"Data": {},
"Message": "NOT_FOUND_ERROR: Model ingestion was not found",
"Type": "SpeckleGraphQLException"
}
}
@@ -1,11 +1,13 @@
using System.Reflection;
using Speckle.Sdk.Api;
using Speckle.Sdk.Api.GraphQL.Inputs;
using Speckle.Sdk.Api.GraphQL.Models;
using Speckle.Sdk.Api.GraphQL.Resources;
using Speckle.Sdk.Host;
using Speckle.Sdk.Models;
namespace Speckle.Sdk.Tests.Integration.API.GraphQL.Resources;
[Trait("Server", "Internal")]
public sealed class ModelIngestionResourceExceptionalTests : IAsyncLifetime
{
private IClient _testUser;
@@ -17,6 +19,9 @@ public sealed class ModelIngestionResourceExceptionalTests : IAsyncLifetime
public async Task InitializeAsync()
{
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, Assembly.GetExecutingAssembly());
_testUser = await Fixtures.SeedUserWithClient();
_project = await _testUser.Project.Create(new("Test project", "", null));
_model = await _testUser.Model.Create(new("Test Model 1", "", _project.id));
@@ -36,8 +41,7 @@ public sealed class ModelIngestionResourceExceptionalTests : IAsyncLifetime
{
_ = await Sut.Create(createInput);
});
Assert.Single(ex.InnerExceptions);
Assert.All(ex.InnerExceptions, item => Assert.IsType<SpeckleGraphQLStreamNotFoundException>(item));
await Verify(ex);
}
[Fact]
@@ -49,8 +53,7 @@ public sealed class ModelIngestionResourceExceptionalTests : IAsyncLifetime
{
_ = await Sut.UpdateProgress(updateInput);
});
Assert.Single(ex.InnerExceptions);
Assert.All(ex.InnerExceptions, item => Assert.IsType<SpeckleGraphQLException>(item));
await Verify(ex);
}
[Fact]
@@ -65,7 +68,6 @@ public sealed class ModelIngestionResourceExceptionalTests : IAsyncLifetime
{
_ = await Sut.FailWithCancel(input);
});
Assert.Single(ex.InnerExceptions);
Assert.All(ex.InnerExceptions, item => Assert.IsType<SpeckleGraphQLException>(item));
await Verify(ex);
}
}
@@ -1,16 +1,17 @@
using Microsoft.Extensions.DependencyInjection;
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Speckle.Sdk.Api;
using Speckle.Sdk.Api.GraphQL.Enums;
using Speckle.Sdk.Api.GraphQL.Inputs;
using Speckle.Sdk.Api.GraphQL.Models;
using Speckle.Sdk.Api.GraphQL.Resources;
using Speckle.Sdk.Host;
using Speckle.Sdk.Models;
using Speckle.Sdk.Transports;
using Version = Speckle.Sdk.Api.GraphQL.Models.Version;
namespace Speckle.Sdk.Tests.Integration.API.GraphQL.Resources;
[Trait("Server", "Internal")]
public sealed class ModelIngestionResourceTests : IAsyncLifetime
{
private IClient _testUser;
@@ -23,6 +24,8 @@ public sealed class ModelIngestionResourceTests : IAsyncLifetime
public async Task InitializeAsync()
{
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, Assembly.GetExecutingAssembly());
var serviceProvider = TestServiceSetup.GetServiceProvider();
_operations = serviceProvider.GetRequiredService<IOperations>();
@@ -126,64 +129,10 @@ public sealed class ModelIngestionResourceTests : IAsyncLifetime
new(true, true)
);
ModelIngestionSuccessInput finish = new(ingest.id, _project.id, sendResult.RootId, "yay!");
ModelIngestionSuccessInput finish = new(ingest.id, _project.id, sendResult.RootId);
string versionId = await Sut.Complete(finish);
Version version = await _testUser.Version.Get(versionId, _project.id);
Assert.Equal(version.id, versionId);
Assert.Equal(sendResult.RootId, version.referencedObject);
}
[Fact]
public async Task CreateAndGet()
{
var createInput = new ModelIngestionCreateInput(
_model.id,
_project.id,
"Starting processing",
new(".NET test runner", "0.0.0", null, null)
);
ModelIngestion ingest = await Sut.Create(createInput);
ModelIngestion res = await Sut.Get(ingest.id, _project.id);
Assert.Equal(ingest.id, res.id);
Assert.Equal(ingest.statusData.status, res.statusData.status);
}
[Fact]
public async Task TestRequeue()
{
//Not sure if is desirable that ingestions created by the modelIngestionMutations.create mutation can be re-queued
//But the server allows it, so we test it
var createInput = new ModelIngestionCreateInput(
_model.id,
_project.id,
"Starting processing",
new(".NET test runner", "0.0.0", null, null)
);
var ingestion = await Sut.Create(createInput);
var res = await Sut.Requeue(new(ingestion.id, _project.id, "we'll try and requeue this ingestion"));
Assert.Equal(ingestion.id, res.id);
Assert.Equal(ModelIngestionStatus.queued, res.statusData.status);
}
[Fact]
public async Task TestStartProcessing()
{
//Not sure if is desirable that StartProcessing can be used by ingestions created by the modelIngestionMutations.create mutation
//But the server allows it, so we test it
var createInput = new ModelIngestionCreateInput(
_model.id,
_project.id,
"Starting processing",
new(".NET test runner", "0.0.0", null, null)
);
var ingestion = await Sut.Create(createInput);
var res = await Sut.StartProcessing(
new(ingestion.id, _project.id, "", new SourceDataInput("what", "happens", "now", 0))
);
Assert.Equal(ingestion.id, res.id);
Assert.Equal(ModelIngestionStatus.processing, res.statusData.status);
}
}
@@ -1,6 +1,5 @@
using FluentAssertions;
using Speckle.Sdk.Api;
using Speckle.Sdk.Api.GraphQL.Enums;
using Speckle.Sdk.Api.GraphQL.Inputs;
using Speckle.Sdk.Api.GraphQL.Models;
using Speckle.Sdk.Api.GraphQL.Resources;
@@ -18,7 +17,7 @@ public class ModelResourceTests : IAsyncLifetime
{
// Runs instead of [SetUp] in NUnit
_testUser = await Fixtures.SeedUserWithClient();
_project = await _testUser.Project.Create(new("Test project", "", ProjectVisibility.Public));
_project = await _testUser.Project.Create(new("Test project", "", null));
_model = await _testUser.Model.Create(new("Test Model", "", _project.id));
}
@@ -124,21 +123,4 @@ public class ModelResourceTests : IAsyncLifetime
var delEx = await FluentActions.Invoking(() => Sut.Delete(input)).Should().ThrowAsync<AggregateException>();
getEx.WithInnerExceptionExactly<SpeckleGraphQLException>();
}
[Fact]
public async Task TestUserHasModelPermissions()
{
var ownerResult = await Sut.GetPermissions(_project.id, _model.id);
ownerResult.canUpdate.authorized.Should().Be(true);
ownerResult.canCreateVersion.authorized.Should().Be(true);
ownerResult.canDelete.authorized.Should().Be(true);
// Test with another user
var guest = await Fixtures.SeedUserWithClient();
var guestResult = await guest.Model.GetPermissions(_project.id, _model.id);
guestResult.canUpdate.authorized.Should().Be(false);
guestResult.canCreateVersion.authorized.Should().Be(false);
guestResult.canDelete.authorized.Should().Be(false);
}
}
@@ -103,30 +103,8 @@ public class ProjectResourceTests
[Fact]
public async Task TestUserHasProjectPermissions()
{
var privateProject = await _testUser.Project.Create(
new ProjectCreateInput("asdfasdf", "desc", ProjectVisibility.Private)
);
var resp = await Sut.GetPermissions(privateProject.id);
resp.canCreateModel.authorized.Should().Be(true);
resp.canDelete.authorized.Should().Be(true);
resp.canLoad.authorized.Should().Be(true);
var publicProject = await _testUser.Project.Create(
new ProjectCreateInput("asdfasdf", "desc", ProjectVisibility.Public)
);
var res = await Sut.GetPermissions(publicProject.id);
var res = await Sut.GetPermissions(_testProject.id);
res.canCreateModel.authorized.Should().Be(true);
res.canDelete.authorized.Should().Be(true);
res.canLoad.authorized.Should().Be(true);
// Test with another user
var guest = await Fixtures.SeedUserWithClient();
var guestResult = await guest.Project.GetPermissions(publicProject.id);
guestResult.canCreateModel.authorized.Should().Be(false);
guestResult.canDelete.authorized.Should().Be(false);
guestResult.canLoad.authorized.Should().Be(false);
}
}
@@ -1,4 +1,4 @@
using FluentAssertions;
using FluentAssertions;
using Speckle.Sdk.Api;
using Speckle.Sdk.Api.GraphQL.Enums;
using Speckle.Sdk.Api.GraphQL.Inputs;
@@ -11,11 +11,11 @@ namespace Speckle.Sdk.Tests.Integration.API.GraphQL.Resources;
public class SubscriptionResourceTests : IAsyncLifetime
{
#if DEBUG
private const int WAIT_PERIOD = 4000; // WSL is slow AF, so for local runs, we're being extra generous
private const int WAIT_PERIOD = 3000; // WSL is slow AF, so for local runs, we're being extra generous
#else
private const int WAIT_PERIOD = 500; // For CI runs, a much smaller wait time is acceptable
private const int WAIT_PERIOD = 400; // For CI runs, a much smaller wait time is acceptable
#endif
private const int TIMEOUT = WAIT_PERIOD + WAIT_PERIOD + 500;
private const int TIMEOUT = WAIT_PERIOD + WAIT_PERIOD + 400;
private IClient _testUser;
private Project _testProject;
private Model _testModel;
@@ -136,15 +136,14 @@ public class SubscriptionResourceTests : IAsyncLifetime
subscriptionMessage.comment.Should().NotBeNull();
}
[Fact(Timeout = TIMEOUT), Trait("Server", "Internal")]
[Fact(Timeout = TIMEOUT)]
public async Task ProjectModelIngestionCancellationRequested_SubscriptionIsCalled()
{
ModelIngestion ingestion = await _testUser.Ingestion.Create(
new(_testModel.id, _testProject.id, "", new(".NET test", "0.0.0", null, null))
);
TaskCompletionSource<ProjectModelIngestionUpdatedMessage> tcs = new();
using var sub = Sut.CreateProjectModelIngestionCancellationRequestedSubscription(ingestion.id, _testProject.id);
using var sub = Sut.CreateProjectModelIngestionCancellationRequestedSubscription(_testProject.id, ingestion.id);
sub.Listeners += (_, message) => tcs.SetResult(message);
await Task.Delay(WAIT_PERIOD); // Give time to subscription to be setup
@@ -154,55 +153,6 @@ public class SubscriptionResourceTests : IAsyncLifetime
var subscriptionMessage = await tcs.Task;
subscriptionMessage.Should().NotBeNull();
subscriptionMessage.type.Should().Be(ProjectModelIngestionUpdatedMessageType.cancellationRequested);
subscriptionMessage.modelIngestion.id.Should().Be(ingestion.id);
}
[Fact(Timeout = TIMEOUT), Trait("Server", "Internal")]
public async Task ProjectModelIngestionUpdate_UpdateSubscriptionIs()
{
ModelIngestion ingestion = await _testUser.Ingestion.Create(
new(_testModel.id, _testProject.id, "", new(".NET test", "0.0.0", null, null))
);
TaskCompletionSource<ProjectModelIngestionUpdatedMessage> tcs = new();
using var sub = Sut.CreateProjectModelIngestionUpdatedSubscription(
new(
_testProject.id,
new ModelIngestionReference(ingestion.id, null),
ProjectModelIngestionUpdatedMessageType.updated
)
);
sub.Listeners += (_, message) => tcs.SetResult(message);
await Task.Delay(WAIT_PERIOD); // Give time to subscription to be setup
await _testUser.Ingestion.UpdateProgress(new(ingestion.id, _testProject.id, "Here's an update", 0.314));
var subscriptionMessage = await tcs.Task;
subscriptionMessage.Should().NotBeNull();
subscriptionMessage.type.Should().Be(ProjectModelIngestionUpdatedMessageType.updated);
subscriptionMessage.modelIngestion.id.Should().Be(ingestion.id);
}
[Fact(Timeout = TIMEOUT), Trait("Server", "Internal")]
public async Task ProjectModelIngestionUpdate_CancelSubscriptionIsNotCalled()
{
ModelIngestion ingestion = await _testUser.Ingestion.Create(
new(_testModel.id, _testProject.id, "", new(".NET test", "0.0.0", null, null))
);
TaskCompletionSource<ProjectModelIngestionUpdatedMessage> tcs = new();
using var sub = Sut.CreateProjectModelIngestionCancellationRequestedSubscription(ingestion.id, _testProject.id);
sub.Listeners += (_, message) => tcs.SetResult(message);
await Task.Delay(WAIT_PERIOD); // Give time to subscription to be setup
await _testUser.Ingestion.UpdateProgress(new(ingestion.id, _testProject.id, "this shouldn't cancel", null));
await Task.Delay(WAIT_PERIOD); // Give time to subscription to maybe fire
tcs.Task.IsCompleted.Should().BeFalse();
}
}
@@ -17,16 +17,11 @@ using Version = Speckle.Sdk.Api.GraphQL.Models.Version;
[assembly: AssemblyTrait("Category", "Integration")]
#if DEBUG
[assembly: CollectionBehavior(MaxParallelThreads = 8)]
#endif
namespace Speckle.Sdk.Tests.Integration;
public static class Fixtures
{
public static readonly ServerInfo Server = new() { url = "http://localhost:3000", name = "Docker Server" };
public static readonly ServerInfo Server = new() { url = "http://localhost", name = "Docker Server" };
public static IServiceProvider ServiceProvider { get; set; }
@@ -1,6 +1,8 @@
using FluentAssertions;
using System.Reflection;
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using Speckle.Sdk.Api;
using Speckle.Sdk.Host;
using Speckle.Sdk.Models;
using Speckle.Sdk.Transports;
@@ -14,7 +16,8 @@ public class MemoryTransportTests : IDisposable
public MemoryTransportTests()
{
CleanData();
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, Assembly.GetExecutingAssembly());
var serviceProvider = TestServiceSetup.GetServiceProvider();
_operations = serviceProvider.GetRequiredService<IOperations>();
}
@@ -1,8 +1,11 @@
using System.Text;
using System.Reflection;
using System.Text;
using Microsoft.Extensions.DependencyInjection;
using Speckle.Sdk.Api;
using Speckle.Sdk.Api.GraphQL.Enums;
using Speckle.Sdk.Api.GraphQL.Models;
using Speckle.Sdk.Host;
using Speckle.Sdk.Models;
namespace Speckle.Sdk.Tests.Integration;
@@ -16,6 +19,8 @@ public sealed class SendReceiveTests : IAsyncLifetime
public async Task InitializeAsync()
{
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, Assembly.GetExecutingAssembly());
var serviceProvider = TestServiceSetup.GetServiceProvider();
_operations = serviceProvider.GetRequiredService<IOperations>();
ClearCache();
@@ -10,14 +10,14 @@ using Speckle.Sdk.Transports;
namespace Speckle.Sdk.Tests.Unit.Api.Operations;
[Collection(nameof(RequiresTypeLoaderCollection))]
public class Closures
{
private readonly IOperations _operations;
public Closures()
{
TypeLoader.ReInitialize(typeof(Base).Assembly, typeof(TableLegFixture).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, typeof(TableLegFixture).Assembly);
var serviceProvider = TestServiceSetup.GetServiceProvider();
_operations = serviceProvider.GetRequiredService<IOperations>();
}
@@ -7,7 +7,6 @@ using Speckle.Sdk.Transports;
namespace Speckle.Sdk.Tests.Unit.Api.Operations;
[Collection(nameof(RequiresTypeLoaderCollection))]
public sealed partial class OperationsReceiveTests : IDisposable
{
private static readonly Base[] s_testObjects;
@@ -45,7 +44,8 @@ public sealed partial class OperationsReceiveTests : IDisposable
private static void Reset()
{
TypeLoader.ReInitialize(typeof(Base).Assembly, Assembly.GetExecutingAssembly());
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, Assembly.GetExecutingAssembly());
}
public static IEnumerable<object[]> TestCases()
@@ -7,14 +7,14 @@ using Speckle.Sdk.Transports;
namespace Speckle.Sdk.Tests.Unit.Api.Operations;
[Collection(nameof(RequiresTypeLoaderCollection))]
public class SendObjectReferences
{
private readonly IOperations _operations;
public SendObjectReferences()
{
TypeLoader.ReInitialize(typeof(Base).Assembly, typeof(DataChunk).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, typeof(DataChunk).Assembly);
var serviceProvider = TestServiceSetup.GetServiceProvider();
_operations = serviceProvider.GetRequiredService<IOperations>();
}
@@ -9,14 +9,14 @@ using Speckle.Sdk.Transports;
namespace Speckle.Sdk.Tests.Unit.Api.Operations;
[Collection(nameof(RequiresTypeLoaderCollection))]
public sealed class SendReceiveLocal : IDisposable
{
private readonly IOperations _operations;
public SendReceiveLocal()
{
TypeLoader.ReInitialize(typeof(Base).Assembly, typeof(Point).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, typeof(Point).Assembly);
var serviceProvider = TestServiceSetup.GetServiceProvider();
_operations = serviceProvider.GetRequiredService<IOperations>();
}
@@ -9,14 +9,14 @@ using Point = Speckle.Sdk.Tests.Unit.Host.Point;
namespace Speckle.Sdk.Tests.Unit.Api.Operations;
[Collection(nameof(RequiresTypeLoaderCollection))]
public class ObjectSerialization
{
private readonly IOperations _operations;
public ObjectSerialization()
{
TypeLoader.ReInitialize(typeof(Base).Assembly, typeof(DataChunk).Assembly, typeof(ColorMock).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, typeof(DataChunk).Assembly, typeof(ColorMock).Assembly);
var serviceProvider = TestServiceSetup.GetServiceProvider();
_operations = serviceProvider.GetRequiredService<IOperations>();
}
+1 -1
View File
@@ -1 +1 @@
[assembly: CollectionBehavior()]
[assembly: CollectionBehavior(DisableTestParallelization = true)]
@@ -1,7 +0,0 @@
namespace Speckle.Sdk.Tests.Unit;
[CollectionDefinition(nameof(RequiresTypeLoaderCollection), DisableParallelization = true)]
public class RequiresTypeLoaderCollection;
[CollectionDefinition(nameof(RequiresSqLiteAccountDb), DisableParallelization = true)]
public class RequiresSqLiteAccountDb;
@@ -9,7 +9,6 @@ using Speckle.Sdk.Testing;
namespace Speckle.Sdk.Tests.Unit.Credentials;
[Collection(nameof(RequiresSqLiteAccountDb))]
public sealed class AccountManagerTests : MoqTest
{
private class TestAccountFactory : IAccountFactory
@@ -5,7 +5,6 @@ using Speckle.Sdk.Credentials;
namespace Speckle.Sdk.Tests.Unit.Credentials;
[Collection(nameof(RequiresSqLiteAccountDb))]
public class AccountServerMigrationTests : IDisposable
{
private readonly List<Account> _accountsToCleanUp = [];
@@ -5,7 +5,6 @@ using Speckle.Sdk.Credentials;
namespace Speckle.Sdk.Tests.Unit.Credentials;
[Collection(nameof(RequiresSqLiteAccountDb))]
public class CredentialInfrastructure : IDisposable
{
private readonly IAccountManager _accountManager;
@@ -5,12 +5,12 @@ using Speckle.Sdk.Models;
namespace Speckle.Sdk.Tests.Unit.Models;
[Collection(nameof(RequiresTypeLoaderCollection))]
public class BaseTests
{
public BaseTests()
{
TypeLoader.ReInitialize(typeof(Base).Assembly, typeof(BaseTests).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, typeof(BaseTests).Assembly);
}
[Fact]
@@ -5,12 +5,12 @@ using Speckle.Sdk.Models;
namespace Speckle.Sdk.Tests.Unit.Models;
[Collection(nameof(RequiresTypeLoaderCollection))]
public class DynamicBaseTests
{
public DynamicBaseTests()
{
TypeLoader.ReInitialize(typeof(Base).Assembly, typeof(BaseTests).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, typeof(BaseTests).Assembly);
}
[Fact]
@@ -6,12 +6,12 @@ using Speckle.Sdk.Models.Extensions;
namespace Speckle.Sdk.Tests.Unit.Models.Extensions;
[Collection(nameof(RequiresTypeLoaderCollection))]
public class BaseExtensionsTests
{
public BaseExtensionsTests()
{
TypeLoader.ReInitialize(typeof(Base).Assembly, typeof(TestBase).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, typeof(TestBase).Assembly);
}
[Theory]
@@ -5,7 +5,6 @@ using Speckle.Sdk.Models.Extensions;
namespace Speckle.Sdk.Tests.Unit.Models.Extensions;
[Collection(nameof(RequiresTypeLoaderCollection))]
public class DisplayValueTests
{
private const string PAYLOAD = "This is my payload";
@@ -18,7 +17,8 @@ public class DisplayValueTests
private static void Reset()
{
TypeLoader.ReInitialize(typeof(Base).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly);
}
[Fact]
@@ -6,12 +6,12 @@ using Speckle.Sdk.Models.GraphTraversal;
namespace Speckle.Sdk.Tests.Unit.Models.GraphTraversal;
[Collection(nameof(RequiresTypeLoaderCollection))]
public class GraphTraversalTests
{
public GraphTraversalTests()
{
TypeLoader.ReInitialize(typeof(Base).Assembly, typeof(TraversalMock).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, typeof(TraversalMock).Assembly);
}
private static IEnumerable<TraversalContext> Traverse(Base testCase, params ITraversalRule[] rules)
@@ -6,12 +6,13 @@ using Speckle.Sdk.Tests.Unit.Host;
namespace Speckle.Sdk.Tests.Unit.Models;
[Collection(nameof(RequiresTypeLoaderCollection))]
// Removed [TestFixture] and [TestOf] annotations as they are NUnit specific
public class Hashing
{
public Hashing()
{
TypeLoader.ReInitialize(typeof(Base).Assembly, typeof(DiningTable).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, typeof(DiningTable).Assembly);
}
[Fact(DisplayName = "Checks that hashing (as represented by object IDs) actually works.")]
@@ -5,13 +5,13 @@ using Speckle.Sdk.Tests.Unit.Models.TestModels;
namespace Speckle.Sdk.Tests.Unit.Models
{
[Collection(nameof(RequiresTypeLoaderCollection))]
public class SpeckleTypeTests
{
public SpeckleTypeTests()
{
// Setup logic during test class initialization
TypeLoader.ReInitialize(typeof(Base).Assembly, typeof(Foo).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, typeof(Foo).Assembly);
}
[Theory]
@@ -7,13 +7,13 @@ using Speckle.Sdk.Transports;
namespace Speckle.Sdk.Tests.Unit.Serialisation;
[Collection(nameof(RequiresTypeLoaderCollection))]
public class ChunkingTests
{
public static IEnumerable<object[]> TestCases()
{
// Initialize type loader
TypeLoader.ReInitialize(typeof(Base).Assembly, typeof(IgnoreTest).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, typeof(IgnoreTest).Assembly);
// Return test data as a collection of objects for xUnit
yield return [CreateDynamicTestCase(10, 100), 10];
@@ -12,12 +12,12 @@ namespace Speckle.Sdk.Tests.Unit.Serialisation;
/// Tests that the <see cref="JsonIgnoreAttribute"/> leads to properties being ignored both from the final JSON output,
/// But also from the id calculation
/// </summary>
[Collection(nameof(RequiresTypeLoaderCollection))]
public sealed class JsonIgnoreRespected
{
public JsonIgnoreRespected()
{
TypeLoader.ReInitialize(typeof(Base).Assembly, typeof(IgnoreTest).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, typeof(IgnoreTest).Assembly);
}
public static IEnumerable<object[]> IgnoredTestCases()
@@ -5,13 +5,13 @@ using Speckle.Sdk.Serialisation.Deprecated;
namespace Speckle.Sdk.Tests.Unit.Serialisation
{
[Collection(nameof(RequiresTypeLoaderCollection))]
public class TypeLoaderTests
{
// Constructor replaces the [SetUp] functionality in NUnit
public TypeLoaderTests()
{
TypeLoader.ReInitialize(typeof(Base).Assembly, typeof(MySpeckleBase).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, typeof(MySpeckleBase).Assembly);
}
[Fact] // Replaces [Test]
@@ -14,7 +14,6 @@ namespace Speckle.Sdk.Tests.Unit.Serialisation;
/// This doesn't guarantee things work this way for SpecklePy
/// Nor does it encompass other tricks (like deserialize callback, or computed json ignored properties)
/// </summary>
[Collection(nameof(RequiresTypeLoaderCollection))]
public class SerializerBreakingChanges : PrimitiveTestFixture
{
private readonly IOperations _operations;
@@ -22,7 +21,8 @@ public class SerializerBreakingChanges : PrimitiveTestFixture
// xUnit does not support a Setup method; instead, you can use the constructor for initialization.
public SerializerBreakingChanges()
{
TypeLoader.ReInitialize(typeof(Base).Assembly, typeof(Point).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(Base).Assembly, typeof(Point).Assembly);
var serviceProvider = TestServiceSetup.GetServiceProvider();
_operations = serviceProvider.GetRequiredService<IOperations>();
}
@@ -9,14 +9,14 @@ using Matrix4x4 = Speckle.DoubleNumerics.Matrix4x4;
namespace Speckle.Sdk.Tests.Unit.Serialisation;
[Collection(nameof(RequiresTypeLoaderCollection))]
public class SerializerNonBreakingChanges : PrimitiveTestFixture
{
private readonly IOperations _operations;
public SerializerNonBreakingChanges()
{
TypeLoader.ReInitialize(typeof(StringValueMock).Assembly);
TypeLoader.Reset();
TypeLoader.Initialize(typeof(StringValueMock).Assembly);
var serviceProvider = TestServiceSetup.GetServiceProvider();
_operations = serviceProvider.GetRequiredService<IOperations>();
}
@@ -1,20 +1,17 @@
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using Speckle.Sdk.Api;
using Speckle.Sdk.Host;
using Speckle.Sdk.Models;
using Speckle.Sdk.Tests.Unit.Host;
namespace Speckle.Sdk.Tests.Unit.Serialisation;
[Collection(nameof(RequiresTypeLoaderCollection))]
public class SimpleRoundTripTests
{
private readonly IOperations _operations;
public SimpleRoundTripTests()
{
TypeLoader.ReInitialize(typeof(DiningTable).Assembly);
var serviceProvider = TestServiceSetup.GetServiceProvider();
_operations = serviceProvider.GetRequiredService<IOperations>();
}