mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 15:11:10 +00:00
Removes the redundant contract and enumeration tests
This commit is contained in:
1 parent
4dce426b38
commit
dc2692e208
127 files changed
-6721
No files matched your search
-65
@@ -1,11 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Fixtures.Core.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Common;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.FileSystem;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.Responses.FileSystemManagement.Common;
|
||||
@@ -16,14 +11,6 @@ namespace Lumina.Contracts.UnitTests.Responses.FileSystemManagement.Common;
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class FileSystemTreeNodeResponseTests
|
||||
{
|
||||
private readonly FileSystemTreeNodeResponseFixture _fileSystemTreeNodeResponseFixture = new();
|
||||
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void Constructor_WhenInstantiatingNode_ShouldInitializeEmptyChildren()
|
||||
{
|
||||
@@ -34,56 +21,4 @@ public class FileSystemTreeNodeResponseTests
|
||||
Assert.NotNull(sut.Children);
|
||||
Assert.Empty(sut.Children);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalled_ShouldReturnValidTreeNode()
|
||||
{
|
||||
// Act
|
||||
FileSystemTreeNodeResponse sut = _fileSystemTreeNodeResponseFixture.Create();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(sut);
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Path));
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Name));
|
||||
Assert.Equal(FileSystemItemType.Directory, sut.ItemType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingTreeNode_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemTreeNodeResponse expected = _fileSystemTreeNodeResponseFixture.Create(maxDepth: 1, maxChildren: 2);
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
FileSystemTreeNodeResponse? actual = JsonSerializer.Deserialize<FileSystemTreeNodeResponse>(json, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected.Path, actual.Path);
|
||||
Assert.Equal(expected.Name, actual.Name);
|
||||
Assert.Equal(expected.ItemType, actual.ItemType);
|
||||
Assert.Equal(expected.Children.Count, actual.Children.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Serialize_WhenSerializingTreeNode_ShouldSerializeItemTypeAsCamelCaseString()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemTreeNodeResponse sut = new()
|
||||
{
|
||||
Path = @"C:\Media",
|
||||
Name = "Media",
|
||||
ItemType = FileSystemItemType.Directory,
|
||||
IsExpanded = false,
|
||||
ChildrenLoaded = true,
|
||||
Children = []
|
||||
};
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(sut, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.Contains("\"ItemType\":\"directory\"", json, StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Fixtures.Core.Responses.FileSystemManagement.Directories;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Directories;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.Responses.FileSystemManagement.Directories;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="DirectoryResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class DirectoryResponseTests
|
||||
{
|
||||
private readonly DirectoryResponseFixture _directoryResponseFixture = new();
|
||||
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalled_ShouldReturnValidDirectoryResponse()
|
||||
{
|
||||
// Act
|
||||
DirectoryResponse sut = _directoryResponseFixture.Create();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(sut);
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Path));
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Name));
|
||||
Assert.NotEmpty(sut.Items);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingDirectoryResponse_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
DirectoryResponse expected = _directoryResponseFixture.Create(itemCount: 2);
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
DirectoryResponse? actual = JsonSerializer.Deserialize<DirectoryResponse>(json, _jsonOptions);
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equivalent(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Deconstruct_WhenCalled_ShouldReturnAllProperties()
|
||||
{
|
||||
// Arrange
|
||||
DirectoryResponse sut = _directoryResponseFixture.Create(itemCount: 1);
|
||||
|
||||
// Act
|
||||
(string path, string name, System.DateTime dateCreated, System.DateTime dateModified, System.Collections.Generic.List<Lumina.Contracts.DTO.FileSystemManagement.FileSystemItemDto> items) = sut;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(sut.Path, path);
|
||||
Assert.Equal(sut.Name, name);
|
||||
Assert.Equal(sut.DateCreated, dateCreated);
|
||||
Assert.Equal(sut.DateModified, dateModified);
|
||||
Assert.Equal(sut.Items, items);
|
||||
}
|
||||
}
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.FileSystem;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.FileSystem;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.Responses.FileSystemManagement.FileSystem;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="FileSystemTypeResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class FileSystemTypeResponseTests
|
||||
{
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingFileSystemTypeResponse_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemTypeResponse expected = new(PlatformType.Windows);
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
FileSystemTypeResponse? actual = JsonSerializer.Deserialize<FileSystemTypeResponse>(json, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Serialize_WhenSerializingFileSystemTypeResponse_ShouldSerializePlatformTypeAsCamelCaseString()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemTypeResponse sut = new(PlatformType.Unix);
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(sut, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.Contains("\"PlatformType\":\"unix\"", json, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
|
||||
{
|
||||
// Arrange
|
||||
FileSystemTypeResponse first = new(PlatformType.Windows);
|
||||
FileSystemTypeResponse second = new(PlatformType.Windows);
|
||||
|
||||
// Act
|
||||
bool areEqual = first == second;
|
||||
|
||||
// Assert
|
||||
Assert.True(areEqual);
|
||||
}
|
||||
}
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Fixtures.Core.Responses.FileSystemManagement.Files;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Files;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.Responses.FileSystemManagement.Files;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="FileResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class FileResponseTests
|
||||
{
|
||||
private readonly FileResponseFixture _fileResponseFixture = new();
|
||||
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalled_ShouldReturnValidFileResponse()
|
||||
{
|
||||
// Act
|
||||
FileResponse sut = _fileResponseFixture.Create();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(sut);
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Path));
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Name));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingFileResponse_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
FileResponse expected = _fileResponseFixture.Create();
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
FileResponse? actual = JsonSerializer.Deserialize<FileResponse>(json, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Deconstruct_WhenCalled_ShouldReturnAllProperties()
|
||||
{
|
||||
// Arrange
|
||||
FileResponse sut = _fileResponseFixture.Create();
|
||||
|
||||
// Act
|
||||
(string path, string name, System.DateTime dateCreated, System.DateTime dateModified, long size) = sut;
|
||||
|
||||
// Assert
|
||||
Assert.Equal(sut.Path, path);
|
||||
Assert.Equal(sut.Name, name);
|
||||
Assert.Equal(sut.DateCreated, dateCreated);
|
||||
Assert.Equal(sut.DateModified, dateModified);
|
||||
Assert.Equal(sut.Size, size);
|
||||
}
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.Responses.FileSystemManagement.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="PathExistsResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PathExistsResponseTests
|
||||
{
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingPathExistsResponse_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
PathExistsResponse expected = new(true);
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
PathExistsResponse? actual = JsonSerializer.Deserialize<PathExistsResponse>(json, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
|
||||
{
|
||||
// Arrange
|
||||
PathExistsResponse first = new(true);
|
||||
PathExistsResponse second = new(true);
|
||||
|
||||
// Act
|
||||
bool areEqual = first == second;
|
||||
|
||||
// Assert
|
||||
Assert.True(areEqual);
|
||||
}
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Fixtures.Core.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.Responses.FileSystemManagement.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="PathSegmentResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PathSegmentResponseTests
|
||||
{
|
||||
private readonly PathSegmentResponseFixture _pathSegmentResponseFixture = new();
|
||||
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalled_ShouldReturnValidPathSegmentResponse()
|
||||
{
|
||||
// Act
|
||||
PathSegmentResponse sut = _pathSegmentResponseFixture.Create();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(sut);
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Path));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingPathSegmentResponse_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
PathSegmentResponse expected = _pathSegmentResponseFixture.Create(path: @"C:\Media");
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
PathSegmentResponse? actual = JsonSerializer.Deserialize<PathSegmentResponse>(json, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
|
||||
{
|
||||
// Arrange
|
||||
PathSegmentResponse first = _pathSegmentResponseFixture.Create(path: @"C:\Media\Books");
|
||||
PathSegmentResponse second = _pathSegmentResponseFixture.Create(path: @"C:\Media\Books");
|
||||
|
||||
// Act
|
||||
bool areEqual = first == second;
|
||||
|
||||
// Assert
|
||||
Assert.True(areEqual);
|
||||
}
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Fixtures.Core.Responses.FileSystemManagement.Path;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.Responses.FileSystemManagement.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="PathSeparatorResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PathSeparatorResponseTests
|
||||
{
|
||||
private readonly PathSeparatorResponseFixture _pathSeparatorResponseFixture = new();
|
||||
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalled_ShouldReturnValidPathSeparatorResponse()
|
||||
{
|
||||
// Act
|
||||
PathSeparatorResponse sut = _pathSeparatorResponseFixture.Create();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(sut);
|
||||
Assert.False(string.IsNullOrWhiteSpace(sut.Separator));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingPathSeparatorResponse_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
PathSeparatorResponse expected = _pathSeparatorResponseFixture.Create(separator: "\\");
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
PathSeparatorResponse? actual = JsonSerializer.Deserialize<PathSeparatorResponse>(json, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
|
||||
{
|
||||
// Arrange
|
||||
PathSeparatorResponse first = _pathSeparatorResponseFixture.Create(separator: "/");
|
||||
PathSeparatorResponse second = _pathSeparatorResponseFixture.Create(separator: "/");
|
||||
|
||||
// Act
|
||||
bool areEqual = first == second;
|
||||
|
||||
// Assert
|
||||
Assert.True(areEqual);
|
||||
}
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Path;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.Responses.FileSystemManagement.Path;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="PathValidResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class PathValidResponseTests
|
||||
{
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingPathValidResponse_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
PathValidResponse expected = new(true);
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
PathValidResponse? actual = JsonSerializer.Deserialize<PathValidResponse>(json, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equality_WhenTwoInstancesHaveSameValues_ShouldBeEqual()
|
||||
{
|
||||
// Arrange
|
||||
PathValidResponse first = new(true);
|
||||
PathValidResponse second = new(true);
|
||||
|
||||
// Act
|
||||
bool areEqual = first == second;
|
||||
|
||||
// Assert
|
||||
Assert.True(areEqual);
|
||||
}
|
||||
}
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Contracts.Fixtures.Core.Responses.FileSystemManagement.Thumbnails;
|
||||
using Lumina.Contracts.Responses.FileSystemManagement.Thumbnails;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.PhotoLibrary;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Contracts.UnitTests.Responses.FileSystemManagement.Thumbnails;
|
||||
|
||||
/// <summary>
|
||||
/// Contains unit tests for the <see cref="ThumbnailResponse"/> record.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ThumbnailResponseTests
|
||||
{
|
||||
private readonly ThumbnailResponseFixture _thumbnailResponseFixture = new();
|
||||
|
||||
private readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public void Create_WhenCalled_ShouldReturnValidThumbnailResponse()
|
||||
{
|
||||
// Act
|
||||
ThumbnailResponse sut = _thumbnailResponseFixture.Create();
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(sut);
|
||||
Assert.NotEmpty(sut.Bytes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_WhenSerializingThumbnailResponse_ShouldPreserveValues()
|
||||
{
|
||||
// Arrange
|
||||
ThumbnailResponse expected = _thumbnailResponseFixture.Create(type: ImageType.JPEG);
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(expected, _jsonOptions);
|
||||
ThumbnailResponse? actual = JsonSerializer.Deserialize<ThumbnailResponse>(json, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected.Type, actual.Type);
|
||||
Assert.Equal(expected.Bytes, actual.Bytes);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Serialize_WhenSerializingThumbnailResponse_ShouldSerializeTypeAsCamelCaseString()
|
||||
{
|
||||
// Arrange
|
||||
ThumbnailResponse sut = _thumbnailResponseFixture.Create(type: ImageType.PNG);
|
||||
|
||||
// Act
|
||||
string json = JsonSerializer.Serialize(sut, _jsonOptions);
|
||||
|
||||
// Assert
|
||||
Assert.Contains("\"Type\":\"png\"", json, StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user