mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 12:11:10 +00:00
Removes FluentAssertions library from test projects, due to licensing changes
This commit is contained in:
1 parent
c1100e5398
commit
d46bfae4fc
235 files changed
+4468
-4725
No files matched your search
+22
-30
@@ -3,7 +3,6 @@ using AutoFixture;
|
||||
using AutoFixture.AutoNSubstitute;
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.Directories.Queries.GetDirectories;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Directories;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Directories;
|
||||
@@ -56,8 +55,8 @@ public class GetDirectoriesEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
IEnumerable<DirectoryResponse> actualResponses = result.Should().BeOfType<Ok<IEnumerable<DirectoryResponse>>>().Subject.Value!;
|
||||
actualResponses.Should().BeEquivalentTo(expectedResponses);
|
||||
Ok<IEnumerable<DirectoryResponse>> okResult = Assert.IsType<Ok<IEnumerable<DirectoryResponse>>>(result);
|
||||
Assert.Equal(expectedResponses, okResult.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -74,17 +73,16 @@ public class GetDirectoriesEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<Microsoft.AspNetCore.Mvc.ProblemDetails>();
|
||||
|
||||
problemDetails.ProblemDetails.Title.Should().Be("Directory.NotFound");
|
||||
problemDetails.ProblemDetails.Detail.Should().Be("The requested directory was not found.");
|
||||
problemDetails.ProblemDetails.Status.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.5");
|
||||
problemDetails.ProblemDetails.Extensions["traceId"].Should().NotBeNull();
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
Assert.IsType<Microsoft.AspNetCore.Mvc.ProblemDetails>(problemDetails.ProblemDetails);
|
||||
|
||||
Assert.Equal("Directory.NotFound", problemDetails.ProblemDetails.Title);
|
||||
Assert.Equal("The requested directory was not found.", problemDetails.ProblemDetails.Detail);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.ProblemDetails.Status);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc9110#section-15.5.5", problemDetails.ProblemDetails.Type);
|
||||
Assert.NotNull(problemDetails.ProblemDetails.Extensions["traceId"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -101,22 +99,16 @@ public class GetDirectoriesEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<HttpValidationProblemDetails>();
|
||||
HttpValidationProblemDetails validationProblemDetails = (HttpValidationProblemDetails)problemDetails.ProblemDetails;
|
||||
validationProblemDetails.Status.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
validationProblemDetails.Title.Should().Be("General.Validation");
|
||||
validationProblemDetails.Detail.Should().Be("OneOrMoreValidationErrorsOccurred");
|
||||
validationProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc4918#section-11.2");
|
||||
validationProblemDetails.Errors.Should().ContainSingle()
|
||||
.Which.Should().BeEquivalentTo(new
|
||||
{
|
||||
Key = "Path.Invalid",
|
||||
Value = new[] { "The provided path is invalid." }
|
||||
});
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
HttpValidationProblemDetails validationProblemDetails = Assert.IsType<HttpValidationProblemDetails>(problemDetails.ProblemDetails);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, validationProblemDetails.Status);
|
||||
Assert.Equal("General.Validation", validationProblemDetails.Title);
|
||||
Assert.Equal("OneOrMoreValidationErrorsOccurred", validationProblemDetails.Detail);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc4918#section-11.2", validationProblemDetails.Type);
|
||||
Assert.Single(validationProblemDetails.Errors);
|
||||
Assert.Equal(new[] { "The provided path is invalid." }, validationProblemDetails.Errors["Path.Invalid"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+11
-13
@@ -1,7 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.Drives.Queries.GetDrives;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Drives.GetDrives;
|
||||
@@ -53,8 +52,8 @@ public class GetDrivesEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(new EmptyRequest(), cancellationToken);
|
||||
|
||||
// Assert
|
||||
IEnumerable<FileSystemTreeNodeResponse> actualResponses = result.Should().BeOfType<Ok<IEnumerable<FileSystemTreeNodeResponse>>>().Subject.Value!;
|
||||
actualResponses.Should().BeEquivalentTo(expectedResponses);
|
||||
Ok<IEnumerable<FileSystemTreeNodeResponse>> okResult = Assert.IsType<Ok<IEnumerable<FileSystemTreeNodeResponse>>>(result);
|
||||
Assert.Equal(expectedResponses, okResult.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -70,17 +69,16 @@ public class GetDrivesEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(new EmptyRequest(), cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<Microsoft.AspNetCore.Mvc.ProblemDetails>();
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
Assert.IsType<Microsoft.AspNetCore.Mvc.ProblemDetails>(problemDetails.ProblemDetails);
|
||||
|
||||
problemDetails.ProblemDetails.Title.Should().Be("Drive.NotFound");
|
||||
problemDetails.ProblemDetails.Detail.Should().Be("The requested drive was not found.");
|
||||
problemDetails.ProblemDetails.Status.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.5");
|
||||
problemDetails.ProblemDetails.Extensions["traceId"].Should().NotBeNull();
|
||||
Assert.Equal("Drive.NotFound", problemDetails.ProblemDetails.Title);
|
||||
Assert.Equal("The requested drive was not found.", problemDetails.ProblemDetails.Detail);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.ProblemDetails.Status);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc9110#section-15.5.5", problemDetails.ProblemDetails.Type);
|
||||
Assert.NotNull(problemDetails.ProblemDetails.Extensions["traceId"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+4
-5
@@ -1,6 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.FileSystem.Queries.GetFileSystem;
|
||||
using Lumina.Domain.Common.Enums.FileSystem;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.FileSystem;
|
||||
@@ -48,8 +47,8 @@ public class GetFileSystemTypeEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(new EmptyRequest(), cancellationToken);
|
||||
|
||||
// Assert
|
||||
Ok<FileSystemTypeResponse> okResult = result.Should().BeOfType<Ok<FileSystemTypeResponse>>().Subject;
|
||||
okResult.Value.Should().BeEquivalentTo(expectedResponse);
|
||||
Ok<FileSystemTypeResponse> okResult = Assert.IsType<Ok<FileSystemTypeResponse>>(result);
|
||||
Assert.Equal(expectedResponse, okResult.Value);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
@@ -67,8 +66,8 @@ public class GetFileSystemTypeEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(new EmptyRequest(), cancellationToken);
|
||||
|
||||
// Assert
|
||||
Ok<FileSystemTypeResponse> okResult = result.Should().BeOfType<Ok<FileSystemTypeResponse>>().Subject;
|
||||
okResult.Value!.PlatformType.Should().Be(platformType);
|
||||
Ok<FileSystemTypeResponse> okResult = Assert.IsType<Ok<FileSystemTypeResponse>>(result);
|
||||
Assert.Equal(platformType, okResult.Value!.PlatformType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+21
-29
@@ -3,7 +3,6 @@ using AutoFixture;
|
||||
using AutoFixture.AutoNSubstitute;
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.Files.Queries.GetFiles;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Files;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Files;
|
||||
@@ -58,8 +57,8 @@ public class GetFilesEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
IEnumerable<FileResponse> actualResponses = result.Should().BeOfType<Ok<IEnumerable<FileResponse>>>().Subject.Value!;
|
||||
actualResponses.Should().BeEquivalentTo(expectedResponses);
|
||||
Ok<IEnumerable<FileResponse>> okResult = Assert.IsType<Ok<IEnumerable<FileResponse>>>(result);
|
||||
Assert.Equal(expectedResponses, okResult.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -76,17 +75,16 @@ public class GetFilesEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<Microsoft.AspNetCore.Mvc.ProblemDetails>();
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
Assert.IsType<Microsoft.AspNetCore.Mvc.ProblemDetails>(problemDetails.ProblemDetails);
|
||||
|
||||
problemDetails.ProblemDetails.Title.Should().Be("File.NotFound");
|
||||
problemDetails.ProblemDetails.Detail.Should().Be("The requested file was not found.");
|
||||
problemDetails.ProblemDetails.Status.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.5");
|
||||
problemDetails.ProblemDetails.Extensions["traceId"].Should().NotBeNull();
|
||||
Assert.Equal("File.NotFound", problemDetails.ProblemDetails.Title);
|
||||
Assert.Equal("The requested file was not found.", problemDetails.ProblemDetails.Detail);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.ProblemDetails.Status);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc9110#section-15.5.5", problemDetails.ProblemDetails.Type);
|
||||
Assert.NotNull(problemDetails.ProblemDetails.Extensions["traceId"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -103,22 +101,16 @@ public class GetFilesEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<HttpValidationProblemDetails>();
|
||||
HttpValidationProblemDetails validationProblemDetails = (HttpValidationProblemDetails)problemDetails.ProblemDetails;
|
||||
validationProblemDetails.Status.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
validationProblemDetails.Title.Should().Be("General.Validation");
|
||||
validationProblemDetails.Detail.Should().Be("OneOrMoreValidationErrorsOccurred");
|
||||
validationProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc4918#section-11.2");
|
||||
validationProblemDetails.Errors.Should().ContainSingle()
|
||||
.Which.Should().BeEquivalentTo(new
|
||||
{
|
||||
Key = "Path.Invalid",
|
||||
Value = new[] { "The provided path is invalid." }
|
||||
});
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
HttpValidationProblemDetails validationProblemDetails = Assert.IsType<HttpValidationProblemDetails>(problemDetails.ProblemDetails);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, validationProblemDetails.Status);
|
||||
Assert.Equal("General.Validation", validationProblemDetails.Title);
|
||||
Assert.Equal("OneOrMoreValidationErrorsOccurred", validationProblemDetails.Detail);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc4918#section-11.2", validationProblemDetails.Type);
|
||||
Assert.Single(validationProblemDetails.Errors);
|
||||
Assert.Equal(new[] { "The provided path is invalid." }, validationProblemDetails.Errors["Path.Invalid"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+21
-29
@@ -3,7 +3,6 @@ using AutoFixture;
|
||||
using AutoFixture.AutoNSubstitute;
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.Files.Queries.GetTreeFiles;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Files;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
@@ -59,8 +58,8 @@ public class GetTreeFilesEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
IEnumerable<FileSystemTreeNodeResponse> actualResponses = result.Should().BeOfType<Ok<IEnumerable<FileSystemTreeNodeResponse>>>().Subject.Value!;
|
||||
actualResponses.Should().BeEquivalentTo(expectedResponses);
|
||||
Ok<IEnumerable<FileSystemTreeNodeResponse>> okResult = Assert.IsType<Ok<IEnumerable<FileSystemTreeNodeResponse>>>(result);
|
||||
Assert.Equal(expectedResponses, okResult.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -77,17 +76,16 @@ public class GetTreeFilesEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<Microsoft.AspNetCore.Mvc.ProblemDetails>();
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
Assert.IsType<Microsoft.AspNetCore.Mvc.ProblemDetails>(problemDetails.ProblemDetails);
|
||||
|
||||
problemDetails.ProblemDetails.Title.Should().Be("File.NotFound");
|
||||
problemDetails.ProblemDetails.Detail.Should().Be("The requested file was not found.");
|
||||
problemDetails.ProblemDetails.Status.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.5");
|
||||
problemDetails.ProblemDetails.Extensions["traceId"].Should().NotBeNull();
|
||||
Assert.Equal("File.NotFound", problemDetails.ProblemDetails.Title);
|
||||
Assert.Equal("The requested file was not found.", problemDetails.ProblemDetails.Detail);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.ProblemDetails.Status);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc9110#section-15.5.5", problemDetails.ProblemDetails.Type);
|
||||
Assert.NotNull(problemDetails.ProblemDetails.Extensions["traceId"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -104,22 +102,16 @@ public class GetTreeFilesEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<HttpValidationProblemDetails>();
|
||||
HttpValidationProblemDetails validationProblemDetails = (HttpValidationProblemDetails)problemDetails.ProblemDetails;
|
||||
validationProblemDetails.Status.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
validationProblemDetails.Title.Should().Be("General.Validation");
|
||||
validationProblemDetails.Detail.Should().Be("OneOrMoreValidationErrorsOccurred");
|
||||
validationProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc4918#section-11.2");
|
||||
validationProblemDetails.Errors.Should().ContainSingle()
|
||||
.Which.Should().BeEquivalentTo(new
|
||||
{
|
||||
Key = "Path.Invalid",
|
||||
Value = new[] { "The provided path is invalid." }
|
||||
});
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
HttpValidationProblemDetails validationProblemDetails = Assert.IsType<HttpValidationProblemDetails>(problemDetails.ProblemDetails);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, validationProblemDetails.Status);
|
||||
Assert.Equal("General.Validation", validationProblemDetails.Title);
|
||||
Assert.Equal("OneOrMoreValidationErrorsOccurred", validationProblemDetails.Detail);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc4918#section-11.2", validationProblemDetails.Type);
|
||||
Assert.Single(validationProblemDetails.Errors);
|
||||
Assert.Equal(new[] { "The provided path is invalid." }, validationProblemDetails.Errors["Path.Invalid"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.CheckPathExists;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
@@ -53,8 +52,8 @@ public class CheckPathExistsEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
PathExistsResponse actualResponse = result.Should().BeOfType<Ok<PathExistsResponse>>().Subject.Value!;
|
||||
actualResponse.Should().BeEquivalentTo(expectedResponse);
|
||||
Ok<PathExistsResponse> okResult = Assert.IsType<Ok<PathExistsResponse>>(result);
|
||||
Assert.Equal(expectedResponse, okResult.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+21
-29
@@ -1,7 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Commands.CombinePath;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
@@ -55,8 +54,8 @@ public class CombinePathEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
PathSegmentResponse actualResponse = result.Should().BeOfType<Ok<PathSegmentResponse>>().Subject.Value!;
|
||||
actualResponse.Should().BeEquivalentTo(expectedResponse);
|
||||
Ok<PathSegmentResponse> okResult = Assert.IsType<Ok<PathSegmentResponse>>(result);
|
||||
Assert.Equal(expectedResponse, okResult.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -73,17 +72,16 @@ public class CombinePathEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<Microsoft.AspNetCore.Mvc.ProblemDetails>();
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
Assert.IsType<Microsoft.AspNetCore.Mvc.ProblemDetails>(problemDetails.ProblemDetails);
|
||||
|
||||
problemDetails.ProblemDetails.Title.Should().Be("Path.NotFound");
|
||||
problemDetails.ProblemDetails.Detail.Should().Be("The requested path was not found.");
|
||||
problemDetails.ProblemDetails.Status.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.5");
|
||||
problemDetails.ProblemDetails.Extensions["traceId"].Should().NotBeNull();
|
||||
Assert.Equal("Path.NotFound", problemDetails.ProblemDetails.Title);
|
||||
Assert.Equal("The requested path was not found.", problemDetails.ProblemDetails.Detail);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.ProblemDetails.Status);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc9110#section-15.5.5", problemDetails.ProblemDetails.Type);
|
||||
Assert.NotNull(problemDetails.ProblemDetails.Extensions["traceId"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -100,22 +98,16 @@ public class CombinePathEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<HttpValidationProblemDetails>();
|
||||
HttpValidationProblemDetails validationProblemDetails = (HttpValidationProblemDetails)problemDetails.ProblemDetails;
|
||||
validationProblemDetails.Status.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
validationProblemDetails.Title.Should().Be("General.Validation");
|
||||
validationProblemDetails.Detail.Should().Be("OneOrMoreValidationErrorsOccurred");
|
||||
validationProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc4918#section-11.2");
|
||||
validationProblemDetails.Errors.Should().ContainSingle()
|
||||
.Which.Should().BeEquivalentTo(new
|
||||
{
|
||||
Key = "Path.Invalid",
|
||||
Value = new[] { "The provided path is invalid." }
|
||||
});
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
HttpValidationProblemDetails validationProblemDetails = Assert.IsType<HttpValidationProblemDetails>(problemDetails.ProblemDetails);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, validationProblemDetails.Status);
|
||||
Assert.Equal("General.Validation", validationProblemDetails.Title);
|
||||
Assert.Equal("OneOrMoreValidationErrorsOccurred", validationProblemDetails.Detail);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc4918#section-11.2", validationProblemDetails.Type);
|
||||
Assert.Single(validationProblemDetails.Errors);
|
||||
Assert.Equal(new[] { "The provided path is invalid." }, validationProblemDetails.Errors["Path.Invalid"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+21
-29
@@ -1,7 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.GetPathParent;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
@@ -57,8 +56,8 @@ public class GetPathParentEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
IEnumerable<PathSegmentResponse> actualResponse = result.Should().BeOfType<Ok<IEnumerable<PathSegmentResponse>>>().Subject.Value!;
|
||||
actualResponse.Should().BeEquivalentTo(expectedResponse);
|
||||
Ok<IEnumerable<PathSegmentResponse>> okResult = Assert.IsType<Ok<IEnumerable<PathSegmentResponse>>>(result);
|
||||
Assert.Equal(expectedResponse, okResult.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -75,17 +74,16 @@ public class GetPathParentEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<Microsoft.AspNetCore.Mvc.ProblemDetails>();
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
Assert.IsType<Microsoft.AspNetCore.Mvc.ProblemDetails>(problemDetails.ProblemDetails);
|
||||
|
||||
problemDetails.ProblemDetails.Title.Should().Be("Path.NotFound");
|
||||
problemDetails.ProblemDetails.Detail.Should().Be("The requested path was not found.");
|
||||
problemDetails.ProblemDetails.Status.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.5");
|
||||
problemDetails.ProblemDetails.Extensions["traceId"].Should().NotBeNull();
|
||||
Assert.Equal("Path.NotFound", problemDetails.ProblemDetails.Title);
|
||||
Assert.Equal("The requested path was not found.", problemDetails.ProblemDetails.Detail);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.ProblemDetails.Status);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc9110#section-15.5.5", problemDetails.ProblemDetails.Type);
|
||||
Assert.NotNull(problemDetails.ProblemDetails.Extensions["traceId"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -102,22 +100,16 @@ public class GetPathParentEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<HttpValidationProblemDetails>();
|
||||
HttpValidationProblemDetails validationProblemDetails = (HttpValidationProblemDetails)problemDetails.ProblemDetails;
|
||||
validationProblemDetails.Status.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
validationProblemDetails.Title.Should().Be("General.Validation");
|
||||
validationProblemDetails.Detail.Should().Be("OneOrMoreValidationErrorsOccurred");
|
||||
validationProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc4918#section-11.2");
|
||||
validationProblemDetails.Errors.Should().ContainSingle()
|
||||
.Which.Should().BeEquivalentTo(new
|
||||
{
|
||||
Key = "Path.Invalid",
|
||||
Value = new[] { "The provided path is invalid." }
|
||||
});
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
HttpValidationProblemDetails validationProblemDetails = Assert.IsType<HttpValidationProblemDetails>(problemDetails.ProblemDetails);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, validationProblemDetails.Status);
|
||||
Assert.Equal("General.Validation", validationProblemDetails.Title);
|
||||
Assert.Equal("OneOrMoreValidationErrorsOccurred", validationProblemDetails.Detail);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc4918#section-11.2", validationProblemDetails.Type);
|
||||
Assert.Single(validationProblemDetails.Errors);
|
||||
Assert.Equal(new[] { "The provided path is invalid." }, validationProblemDetails.Errors["Path.Invalid"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+21
-29
@@ -1,7 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.GetPathRoot;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
@@ -55,8 +54,8 @@ public class GetPathRootEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
PathSegmentResponse actualResponse = result.Should().BeOfType<Ok<PathSegmentResponse>>().Subject.Value!;
|
||||
actualResponse.Should().BeEquivalentTo(expectedResponse);
|
||||
Ok<PathSegmentResponse> okResult = Assert.IsType<Ok<PathSegmentResponse>>(result);
|
||||
Assert.Equal(expectedResponse, okResult.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -73,17 +72,16 @@ public class GetPathRootEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<Microsoft.AspNetCore.Mvc.ProblemDetails>();
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
Assert.IsType<Microsoft.AspNetCore.Mvc.ProblemDetails>(problemDetails.ProblemDetails);
|
||||
|
||||
problemDetails.ProblemDetails.Title.Should().Be("Path.NotFound");
|
||||
problemDetails.ProblemDetails.Detail.Should().Be("The requested path was not found.");
|
||||
problemDetails.ProblemDetails.Status.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.5");
|
||||
problemDetails.ProblemDetails.Extensions["traceId"].Should().NotBeNull();
|
||||
Assert.Equal("Path.NotFound", problemDetails.ProblemDetails.Title);
|
||||
Assert.Equal("The requested path was not found.", problemDetails.ProblemDetails.Detail);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.ProblemDetails.Status);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc9110#section-15.5.5", problemDetails.ProblemDetails.Type);
|
||||
Assert.NotNull(problemDetails.ProblemDetails.Extensions["traceId"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -100,22 +98,16 @@ public class GetPathRootEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<HttpValidationProblemDetails>();
|
||||
HttpValidationProblemDetails validationProblemDetails = (HttpValidationProblemDetails)problemDetails.ProblemDetails;
|
||||
validationProblemDetails.Status.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
validationProblemDetails.Title.Should().Be("General.Validation");
|
||||
validationProblemDetails.Detail.Should().Be("OneOrMoreValidationErrorsOccurred");
|
||||
validationProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc4918#section-11.2");
|
||||
validationProblemDetails.Errors.Should().ContainSingle()
|
||||
.Which.Should().BeEquivalentTo(new
|
||||
{
|
||||
Key = "Path.Invalid",
|
||||
Value = new[] { "The provided path is invalid." }
|
||||
});
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
HttpValidationProblemDetails validationProblemDetails = Assert.IsType<HttpValidationProblemDetails>(problemDetails.ProblemDetails);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, validationProblemDetails.Status);
|
||||
Assert.Equal("General.Validation", validationProblemDetails.Title);
|
||||
Assert.Equal("OneOrMoreValidationErrorsOccurred", validationProblemDetails.Detail);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc4918#section-11.2", validationProblemDetails.Type);
|
||||
Assert.Single(validationProblemDetails.Errors);
|
||||
Assert.Equal(new[] { "The provided path is invalid." }, validationProblemDetails.Errors["Path.Invalid"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+2
-3
@@ -1,6 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.GetPathSeparator;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Presentation.Api.Core.Endpoints.FileSystemManagement.Path.GetPathSeparator;
|
||||
@@ -50,8 +49,8 @@ public class GetPathSeparatorEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(cancellationToken);
|
||||
|
||||
// Assert
|
||||
PathSeparatorResponse actualResponse = result.Should().BeOfType<Ok<PathSeparatorResponse>>().Subject.Value!;
|
||||
actualResponse.Should().BeEquivalentTo(expectedResponse);
|
||||
Ok<PathSeparatorResponse> okResult = Assert.IsType<Ok<PathSeparatorResponse>>(result);
|
||||
Assert.Equal(expectedResponse, okResult.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+13
-19
@@ -1,7 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Commands.SplitPath;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
@@ -57,8 +56,8 @@ public class SplitPathEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
IEnumerable<PathSegmentResponse> actualResponse = result.Should().BeOfType<Ok<IEnumerable<PathSegmentResponse>>>().Subject.Value!;
|
||||
actualResponse.Should().BeEquivalentTo(expectedResponse);
|
||||
Ok<IEnumerable<PathSegmentResponse>> okResult = Assert.IsType<Ok<IEnumerable<PathSegmentResponse>>>(result);
|
||||
Assert.Equal(expectedResponse, okResult.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -75,22 +74,17 @@ public class SplitPathEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<HttpValidationProblemDetails>();
|
||||
HttpValidationProblemDetails validationProblemDetails = (HttpValidationProblemDetails)problemDetails.ProblemDetails;
|
||||
validationProblemDetails.Status.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
validationProblemDetails.Title.Should().Be("General.Validation");
|
||||
validationProblemDetails.Detail.Should().Be("OneOrMoreValidationErrorsOccurred");
|
||||
validationProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc4918#section-11.2");
|
||||
validationProblemDetails.Errors.Should().ContainSingle()
|
||||
.Which.Should().BeEquivalentTo(new
|
||||
{
|
||||
Key = "Path.Invalid",
|
||||
Value = new[] { "The provided path is invalid." }
|
||||
});
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
HttpValidationProblemDetails validationProblemDetails = Assert.IsType<HttpValidationProblemDetails>(problemDetails.ProblemDetails);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, validationProblemDetails.Status);
|
||||
Assert.Equal("General.Validation", validationProblemDetails.Title);
|
||||
Assert.Equal("OneOrMoreValidationErrorsOccurred", validationProblemDetails.Detail);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc4918#section-11.2", validationProblemDetails.Type);
|
||||
Assert.Single(validationProblemDetails.Errors);
|
||||
Assert.Equal(new[] { "The provided path is invalid." }, validationProblemDetails.Errors["Path.Invalid"]);
|
||||
Assert.NotNull(problemDetails.ProblemDetails.Extensions["traceId"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+2
-3
@@ -1,6 +1,5 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.Paths.Queries.ValidatePath;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
@@ -52,8 +51,8 @@ public class ValidatePathEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
PathValidResponse actualResponse = result.Should().BeOfType<Ok<PathValidResponse>>().Subject.Value!;
|
||||
actualResponse.Should().BeEquivalentTo(expectedResponse);
|
||||
Ok<PathValidResponse> okResult = Assert.IsType<Ok<PathValidResponse>>(result);
|
||||
Assert.Equal(expectedResponse, okResult.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+22
-30
@@ -1,7 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using FastEndpoints;
|
||||
using FluentAssertions;
|
||||
using Lumina.Application.Core.FileSystemManagement.Thumbnails.Queries.GetThumbnail;
|
||||
using Lumina.Contracts.Requests.FileSystemManagement.Thumbnails;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Thumbnails;
|
||||
@@ -54,9 +53,9 @@ public class GetThumbnailEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
FileContentHttpResult fileResult = result.Should().BeOfType<FileContentHttpResult>().Subject;
|
||||
fileResult.FileContents.ToArray().Should().BeEquivalentTo(expectedResponse.Bytes);
|
||||
fileResult.ContentType.Should().Be(MimeTypes.GetMimeType(expectedResponse.Type));
|
||||
FileContentHttpResult fileResult = Assert.IsType<FileContentHttpResult>(result);
|
||||
Assert.Equal(expectedResponse.Bytes, fileResult.FileContents.ToArray());
|
||||
Assert.Equal(MimeTypes.GetMimeType(expectedResponse.Type), fileResult.ContentType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -73,17 +72,16 @@ public class GetThumbnailEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<Microsoft.AspNetCore.Mvc.ProblemDetails>();
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
Assert.IsType<Microsoft.AspNetCore.Mvc.ProblemDetails>(problemDetails.ProblemDetails);
|
||||
|
||||
problemDetails.ProblemDetails.Title.Should().Be("Thumbnail.NotFound");
|
||||
problemDetails.ProblemDetails.Detail.Should().Be("The requested thumbnail was not found.");
|
||||
problemDetails.ProblemDetails.Status.Should().Be(StatusCodes.Status404NotFound);
|
||||
problemDetails.ProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc9110#section-15.5.5");
|
||||
problemDetails.ProblemDetails.Extensions["traceId"].Should().NotBeNull();
|
||||
Assert.Equal("Thumbnail.NotFound", problemDetails.ProblemDetails.Title);
|
||||
Assert.Equal("The requested thumbnail was not found.", problemDetails.ProblemDetails.Detail);
|
||||
Assert.Equal(StatusCodes.Status404NotFound, problemDetails.ProblemDetails.Status);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc9110#section-15.5.5", problemDetails.ProblemDetails.Type);
|
||||
Assert.NotNull(problemDetails.ProblemDetails.Extensions["traceId"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -100,22 +98,16 @@ public class GetThumbnailEndpointTests
|
||||
IResult result = await _sut.ExecuteAsync(request, cancellationToken);
|
||||
|
||||
// Assert
|
||||
result.Should().BeOfType<ProblemHttpResult>();
|
||||
ProblemHttpResult problemDetails = (ProblemHttpResult)result;
|
||||
problemDetails.StatusCode.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
problemDetails.ContentType.Should().Be("application/problem+json");
|
||||
problemDetails.ProblemDetails.Should().BeOfType<HttpValidationProblemDetails>();
|
||||
HttpValidationProblemDetails validationProblemDetails = (HttpValidationProblemDetails)problemDetails.ProblemDetails;
|
||||
validationProblemDetails.Status.Should().Be(StatusCodes.Status422UnprocessableEntity);
|
||||
validationProblemDetails.Title.Should().Be("General.Validation");
|
||||
validationProblemDetails.Detail.Should().Be("OneOrMoreValidationErrorsOccurred");
|
||||
validationProblemDetails.Type.Should().Be("https://tools.ietf.org/html/rfc4918#section-11.2");
|
||||
validationProblemDetails.Errors.Should().ContainSingle()
|
||||
.Which.Should().BeEquivalentTo(new
|
||||
{
|
||||
Key = "Path.Invalid",
|
||||
Value = new[] { "The provided path is invalid." }
|
||||
});
|
||||
ProblemHttpResult problemDetails = Assert.IsType<ProblemHttpResult>(result);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, problemDetails.StatusCode);
|
||||
Assert.Equal("application/problem+json", problemDetails.ContentType);
|
||||
HttpValidationProblemDetails validationProblemDetails = Assert.IsType<HttpValidationProblemDetails>(problemDetails.ProblemDetails);
|
||||
Assert.Equal(StatusCodes.Status422UnprocessableEntity, validationProblemDetails.Status);
|
||||
Assert.Equal("General.Validation", validationProblemDetails.Title);
|
||||
Assert.Equal("OneOrMoreValidationErrorsOccurred", validationProblemDetails.Detail);
|
||||
Assert.Equal("https://tools.ietf.org/html/rfc4918#section-11.2", validationProblemDetails.Type);
|
||||
Assert.Single(validationProblemDetails.Errors);
|
||||
Assert.Equal(new[] { "The provided path is invalid." }, validationProblemDetails.Errors["Path.Invalid"]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in new issue
Block a user