mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 13:11:10 +00:00
Formats code comments as sentences in the tests.
Capitalizes the first word and adds the terminal period in the unit, integration and security tests. The AAA markers stay bare, the TODO bodies stay lowercase, and no assertion, payload, expected status code or test signature changes.
This commit is contained in:
1 parent
727aa33318
commit
057f557791
540 files changed
+3888
-3888
No files matched your search
+1
-1
@@ -102,7 +102,7 @@ public class DomainEventPublisherTests
|
||||
await publisher.PublishAsync(domainEvent, CancellationToken.None);
|
||||
|
||||
// Assert
|
||||
// reaching this point without an exception means the publish was a no-op, as expected
|
||||
// Reaching this point without an exception means the publish was a no-op, as expected.
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
+13
-13
@@ -33,13 +33,13 @@ public class PublicHostRedirectHandlerTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("http://127.0.0.1/cover.jpg")] // the IPv4 loopback address
|
||||
[InlineData("http://localhost/cover.jpg")] // the loopback host name
|
||||
[InlineData("http://[::1]/cover.jpg")] // the IPv6 loopback address
|
||||
[InlineData("http://169.254.169.254/latest/meta-data/")] // the link local cloud metadata endpoint
|
||||
[InlineData("http://10.0.0.5/cover.jpg")] // a private class A address
|
||||
[InlineData("http://172.16.0.1/cover.jpg")] // a private class B address
|
||||
[InlineData("http://192.168.1.10/cover.jpg")] // a private class C address
|
||||
[InlineData("http://127.0.0.1/cover.jpg")] // The IPv4 loopback address.
|
||||
[InlineData("http://localhost/cover.jpg")] // The loopback host name.
|
||||
[InlineData("http://[::1]/cover.jpg")] // The IPv6 loopback address.
|
||||
[InlineData("http://169.254.169.254/latest/meta-data/")] // The link local cloud metadata endpoint.
|
||||
[InlineData("http://10.0.0.5/cover.jpg")] // A private class A address.
|
||||
[InlineData("http://172.16.0.1/cover.jpg")] // A private class B address.
|
||||
[InlineData("http://192.168.1.10/cover.jpg")] // A private class C address.
|
||||
public async Task SendAsync_WhenTheInitialRequestHostIsPrivateOrLocal_ShouldThrowAndNotSendTheRequest(string url)
|
||||
{
|
||||
// Arrange
|
||||
@@ -83,12 +83,12 @@ public class PublicHostRedirectHandlerTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("http://archive.org/index.json")] // a downgrade of a trusted host to plain HTTP
|
||||
[InlineData("https://127.0.0.1/index.json")] // the IPv4 loopback address
|
||||
[InlineData("https://localhost/index.json")] // the loopback host name
|
||||
[InlineData("https://169.254.169.254/latest/meta-data/")] // the link local cloud metadata endpoint
|
||||
[InlineData("https://10.0.0.5/index.json")] // a private class A address
|
||||
[InlineData("https://192.168.1.10/index.json")] // a private class C address
|
||||
[InlineData("http://archive.org/index.json")] // A downgrade of a trusted host to plain HTTP.
|
||||
[InlineData("https://127.0.0.1/index.json")] // The IPv4 loopback address.
|
||||
[InlineData("https://localhost/index.json")] // The loopback host name.
|
||||
[InlineData("https://169.254.169.254/latest/meta-data/")] // The link local cloud metadata endpoint.
|
||||
[InlineData("https://10.0.0.5/index.json")] // A private class A address.
|
||||
[InlineData("https://192.168.1.10/index.json")] // A private class C address.
|
||||
public async Task SendAsync_WhenTheInitialRequestRedirectsToADisallowedTarget_ShouldThrow(string location)
|
||||
{
|
||||
// Arrange
|
||||
|
||||
+25
-25
@@ -12,13 +12,13 @@ namespace Lumina.Infrastructure.UnitTests.Common.Networking;
|
||||
public class PublicHostValidatorTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("coverartarchive.org")] // a public host name
|
||||
[InlineData("example.com")] // a public host name
|
||||
[InlineData("8.8.8.8")] // a public IPv4 address
|
||||
[InlineData("1.1.1.1")] // a public IPv4 address
|
||||
[InlineData("172.15.0.1")] // the address just below the private class B range
|
||||
[InlineData("172.32.0.1")] // the address just above the private class B range
|
||||
[InlineData("2606:4700:4700::1111")] // a public IPv6 address
|
||||
[InlineData("coverartarchive.org")] // A public host name.
|
||||
[InlineData("example.com")] // A public host name.
|
||||
[InlineData("8.8.8.8")] // A public IPv4 address.
|
||||
[InlineData("1.1.1.1")] // A public IPv4 address.
|
||||
[InlineData("172.15.0.1")] // The address just below the private class B range.
|
||||
[InlineData("172.32.0.1")] // The address just above the private class B range.
|
||||
[InlineData("2606:4700:4700::1111")] // A public IPv6 address.
|
||||
public void IsPublicHost_WhenTheHostIsPublic_ShouldReturnTrue(string host)
|
||||
{
|
||||
// Act
|
||||
@@ -29,24 +29,24 @@ public class PublicHostValidatorTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("")] // an empty host
|
||||
[InlineData(" ")] // only white space
|
||||
[InlineData("localhost")] // the loopback host name
|
||||
[InlineData("LOCALHOST")] // the loopback host name, upper cased
|
||||
[InlineData("127.0.0.1")] // the IPv4 loopback address
|
||||
[InlineData("::1")] // the IPv6 loopback address
|
||||
[InlineData("[::1]")] // the IPv6 loopback address, bracketed like a URI host
|
||||
[InlineData("0.0.0.0")] // the unspecified IPv4 address
|
||||
[InlineData("[::]")] // the unspecified IPv6 address
|
||||
[InlineData("169.254.169.254")] // the link local cloud metadata endpoint
|
||||
[InlineData("10.0.0.5")] // a private class A address
|
||||
[InlineData("172.16.0.1")] // the lower bound of the private class B range
|
||||
[InlineData("172.31.255.255")] // the upper bound of the private class B range
|
||||
[InlineData("192.168.1.10")] // a private class C address
|
||||
[InlineData("100.64.0.1")] // the lower bound of the carrier grade NAT range
|
||||
[InlineData("100.127.255.255")] // the upper bound of the carrier grade NAT range
|
||||
[InlineData("fc00::1")] // the IPv6 unique local range
|
||||
[InlineData("fe80::1")] // the IPv6 link local range
|
||||
[InlineData("")] // An empty host.
|
||||
[InlineData(" ")] // Only white space.
|
||||
[InlineData("localhost")] // The loopback host name.
|
||||
[InlineData("LOCALHOST")] // The loopback host name, upper cased.
|
||||
[InlineData("127.0.0.1")] // The IPv4 loopback address.
|
||||
[InlineData("::1")] // The IPv6 loopback address.
|
||||
[InlineData("[::1]")] // The IPv6 loopback address, bracketed like a URI host.
|
||||
[InlineData("0.0.0.0")] // The unspecified IPv4 address.
|
||||
[InlineData("[::]")] // The unspecified IPv6 address.
|
||||
[InlineData("169.254.169.254")] // The link local cloud metadata endpoint.
|
||||
[InlineData("10.0.0.5")] // A private class A address.
|
||||
[InlineData("172.16.0.1")] // The lower bound of the private class B range.
|
||||
[InlineData("172.31.255.255")] // The upper bound of the private class B range.
|
||||
[InlineData("192.168.1.10")] // A private class C address.
|
||||
[InlineData("100.64.0.1")] // The lower bound of the carrier grade NAT range.
|
||||
[InlineData("100.127.255.255")] // The upper bound of the carrier grade NAT range.
|
||||
[InlineData("fc00::1")] // The IPv6 unique local range.
|
||||
[InlineData("fe80::1")] // The IPv6 link local range.
|
||||
public void IsPublicHost_WhenTheHostIsPrivateOrLocal_ShouldReturnFalse(string host)
|
||||
{
|
||||
// Act
|
||||
|
||||
+2
-2
@@ -96,8 +96,8 @@ public class ExceptionUtilitiesTests
|
||||
List<Exception> result = [.. exception.GetInnerExceptions()];
|
||||
|
||||
// Assert
|
||||
// the aggregate exception itself, its inner exceptions and their inners are traversed, and the first inner exception
|
||||
// is also reachable through the regular InnerException chain, so it is yielded twice
|
||||
// The aggregate exception itself, its inner exceptions and their inners are traversed, and the first inner exception
|
||||
// is also reachable through the regular InnerException chain, so it is yielded twice.
|
||||
Assert.Equal(6, result.Count);
|
||||
Assert.Contains(result, inner => inner is AggregateException);
|
||||
Assert.Equal(2, result.Count(inner => inner.Message == "first-inner"));
|
||||
|
||||
+15
-15
@@ -13,18 +13,18 @@ namespace Lumina.Infrastructure.UnitTests.Common.Utilities;
|
||||
public class ImageTypeUtilitiesTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(ImageType.BMP, "bmp")] // bitmap image
|
||||
[InlineData(ImageType.GIF, "gif")] // graphics interchange format
|
||||
[InlineData(ImageType.PNG, "png")] // portable network graphics
|
||||
[InlineData(ImageType.TIFF, "tiff")] // tagged image file format
|
||||
[InlineData(ImageType.PICT, "pct")] // macintosh picture
|
||||
[InlineData(ImageType.ICO, "ico")] // icon format
|
||||
[InlineData(ImageType.PSD, "psd")] // photoshop document
|
||||
[InlineData(ImageType.JPEG2000, "jp2")] // jpeg 2000
|
||||
[InlineData(ImageType.AVIF, "avif")] // av1 image file format
|
||||
[InlineData(ImageType.WEBP, "webp")] // web picture format
|
||||
[InlineData(ImageType.TGA, "tga")] // truevision tga
|
||||
[InlineData(ImageType.SVG, "svg")] // scalable vector graphics
|
||||
[InlineData(ImageType.BMP, "bmp")] // Bitmap image.
|
||||
[InlineData(ImageType.GIF, "gif")] // Graphics interchange format.
|
||||
[InlineData(ImageType.PNG, "png")] // Portable network graphics.
|
||||
[InlineData(ImageType.TIFF, "tiff")] // Tagged image file format.
|
||||
[InlineData(ImageType.PICT, "pct")] // Macintosh picture.
|
||||
[InlineData(ImageType.ICO, "ico")] // Icon format.
|
||||
[InlineData(ImageType.PSD, "psd")] // Photoshop document.
|
||||
[InlineData(ImageType.JPEG2000, "jp2")] // JPEG 2000.
|
||||
[InlineData(ImageType.AVIF, "avif")] // AV1 image file format.
|
||||
[InlineData(ImageType.WEBP, "webp")] // Web picture format.
|
||||
[InlineData(ImageType.TGA, "tga")] // Truevision TGA.
|
||||
[InlineData(ImageType.SVG, "svg")] // Scalable vector graphics.
|
||||
public void ToFileExtension_WhenTypeIsRecognized_ShouldReturnConventionalExtension(ImageType imageType, string expectedExtension)
|
||||
{
|
||||
// Act
|
||||
@@ -35,9 +35,9 @@ public class ImageTypeUtilitiesTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ImageType.JPEG)] // joint photographic experts group
|
||||
[InlineData(ImageType.JPEG_CANON)] // canon-specific jpeg
|
||||
[InlineData(ImageType.JPEG_UNKNOWN)] // unknown jpeg
|
||||
[InlineData(ImageType.JPEG)] // Joint photographic experts group.
|
||||
[InlineData(ImageType.JPEG_CANON)] // Canon-specific JPEG.
|
||||
[InlineData(ImageType.JPEG_UNKNOWN)] // Unknown JPEG.
|
||||
public void ToFileExtension_WhenTypeIsAnyJpeg_ShouldReturnJpg(ImageType imageType)
|
||||
{
|
||||
// Act
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public class EncryptionSettingsDtoValidatorTests
|
||||
{
|
||||
// Arrange
|
||||
EncryptionSettingsDto model = _fixture.Build<EncryptionSettingsDto>()
|
||||
.With(x => x.SecretKey, "dGhpcyBpcyBhIHZhbGlkIGJhc2U2NCBzdHJpbmc=") // "this is a valid base64 string" in base64
|
||||
.With(x => x.SecretKey, "dGhpcyBpcyBhIHZhbGlkIGJhc2U2NCBzdHJpbmc=") // "this is a valid base64 string" in base64.
|
||||
.Create();
|
||||
|
||||
// Act
|
||||
|
||||
+8
-8
@@ -75,8 +75,8 @@ public class ThemeEngineOptionsDtoValidatorTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0L)] // zero, not positive
|
||||
[InlineData(-1L)] // negative
|
||||
[InlineData(0L)] // Zero, not positive.
|
||||
[InlineData(-1L)] // Negative.
|
||||
public void Validate_WhenMaxArchiveBytesIsNotPositive_ShouldHaveValidationError(long maxArchiveBytes)
|
||||
{
|
||||
// Arrange
|
||||
@@ -91,8 +91,8 @@ public class ThemeEngineOptionsDtoValidatorTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0L)] // zero, not positive
|
||||
[InlineData(-1L)] // negative
|
||||
[InlineData(0L)] // Zero, not positive.
|
||||
[InlineData(-1L)] // Negative.
|
||||
public void Validate_WhenMaxExpandedBytesIsNotPositive_ShouldHaveValidationError(long maxExpandedBytes)
|
||||
{
|
||||
// Arrange
|
||||
@@ -107,8 +107,8 @@ public class ThemeEngineOptionsDtoValidatorTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0L)] // zero, not positive
|
||||
[InlineData(-1L)] // negative
|
||||
[InlineData(0L)] // Zero, not positive.
|
||||
[InlineData(-1L)] // Negative.
|
||||
public void Validate_WhenMaxSingleFileBytesIsNotPositive_ShouldHaveValidationError(long maxSingleFileBytes)
|
||||
{
|
||||
// Arrange
|
||||
@@ -123,8 +123,8 @@ public class ThemeEngineOptionsDtoValidatorTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0)] // zero, not positive
|
||||
[InlineData(-1)] // negative
|
||||
[InlineData(0)] // Zero, not positive.
|
||||
[InlineData(-1)] // Negative.
|
||||
public void Validate_WhenMaxEntriesIsNotPositive_ShouldHaveValidationError(int maxEntries)
|
||||
{
|
||||
// Arrange
|
||||
|
||||
+15
-15
@@ -78,9 +78,9 @@ public class TranscodingSettingsDtoValidatorTests : IDisposable
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)] // a missing ffmpeg path
|
||||
[InlineData("")] // an empty ffmpeg path
|
||||
[InlineData(" ")] // a whitespace ffmpeg path
|
||||
[InlineData(null)] // A missing ffmpeg path.
|
||||
[InlineData("")] // An empty ffmpeg path.
|
||||
[InlineData(" ")] // A whitespace ffmpeg path.
|
||||
public void Validate_WhenFfmpegPathIsEmpty_ShouldHaveFfmpegPathCannotBeEmptyError(string? ffmpegPath)
|
||||
{
|
||||
// Arrange
|
||||
@@ -94,8 +94,8 @@ public class TranscodingSettingsDtoValidatorTests : IDisposable
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0)] // a job count of zero disables normalization
|
||||
[InlineData(-1)] // a negative job count disables normalization
|
||||
[InlineData(0)] // A job count of zero disables normalization.
|
||||
[InlineData(-1)] // A negative job count disables normalization.
|
||||
public void Validate_WhenMaxConcurrentJobsIsNotPositive_ShouldHaveMaxConcurrentJobsMustBePositiveError(int maxConcurrentJobs)
|
||||
{
|
||||
// Arrange
|
||||
@@ -136,8 +136,8 @@ public class TranscodingSettingsDtoValidatorTests : IDisposable
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0)] // a per-user job count of zero never admits a normalization
|
||||
[InlineData(-1)] // a negative per-user job count never admits a normalization
|
||||
[InlineData(0)] // A per-user job count of zero never admits a normalization.
|
||||
[InlineData(-1)] // A negative per-user job count never admits a normalization.
|
||||
public void Validate_WhenMaxConcurrentJobsPerUserIsNotPositive_ShouldHaveMaxConcurrentJobsPerUserMustBePositiveError(int maxConcurrentJobsPerUser)
|
||||
{
|
||||
// Arrange
|
||||
@@ -178,8 +178,8 @@ public class TranscodingSettingsDtoValidatorTests : IDisposable
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0)] // a cache with no capacity cannot hold a normalized track
|
||||
[InlineData(-1)] // a negative cache size is not a capacity
|
||||
[InlineData(0)] // A cache with no capacity cannot hold a normalized track.
|
||||
[InlineData(-1)] // A negative cache size is not a capacity.
|
||||
public void Validate_WhenMaxCacheBytesIsNotPositive_ShouldHaveMaxCacheBytesMustBePositiveError(long maxCacheBytes)
|
||||
{
|
||||
// Arrange
|
||||
@@ -193,8 +193,8 @@ public class TranscodingSettingsDtoValidatorTests : IDisposable
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0)] // a job timeout of zero stops every job immediately
|
||||
[InlineData(-1)] // a negative job timeout stops every job immediately
|
||||
[InlineData(0)] // A job timeout of zero stops every job immediately.
|
||||
[InlineData(-1)] // A negative job timeout stops every job immediately.
|
||||
public void Validate_WhenJobTimeoutSecondsIsNotPositive_ShouldHaveJobTimeoutMustBePositiveError(int jobTimeoutSeconds)
|
||||
{
|
||||
// Arrange
|
||||
@@ -235,8 +235,8 @@ public class TranscodingSettingsDtoValidatorTests : IDisposable
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0)] // an eviction grace of zero protects nothing
|
||||
[InlineData(-1)] // a negative eviction grace protects nothing
|
||||
[InlineData(0)] // An eviction grace of zero protects nothing.
|
||||
[InlineData(-1)] // A negative eviction grace protects nothing.
|
||||
public void Validate_WhenEvictionGraceSecondsIsNotPositive_ShouldHaveEvictionGraceSecondsMustBePositiveError(int evictionGraceSeconds)
|
||||
{
|
||||
// Arrange
|
||||
@@ -386,8 +386,8 @@ public class TranscodingSettingsDtoValidatorTests : IDisposable
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)] // no configured directory, so the default temporary directory is used
|
||||
[InlineData(" ")] // a whitespace directory, so the default temporary directory is used
|
||||
[InlineData(null)] // No configured directory, so the default temporary directory is used.
|
||||
[InlineData(" ")] // A whitespace directory, so the default temporary directory is used.
|
||||
public void Validate_WhenCacheDirectoryIsNotConfigured_ShouldOnlyValidateTheDefaultDirectory(string? cacheDirectory)
|
||||
{
|
||||
// Arrange
|
||||
|
||||
Reference in new issue
Block a user