mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 15: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
+7
-7
@@ -13,11 +13,11 @@ namespace Lumina.Presentation.Api.UnitTests.Common.MimeTypes;
|
||||
public class ImageMimeTypesTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(ImageType.BMP, "image/bmp")] // bmp image type
|
||||
[InlineData(ImageType.JPEG, "image/jpeg")] // jpeg image type
|
||||
[InlineData(ImageType.JPEG_CANON, "image/jpeg")] // canon jpeg image type
|
||||
[InlineData(ImageType.SVG, "image/svg+xml")] // svg image type
|
||||
[InlineData(ImageType.TGA, "image/x-tga")] // tga image type
|
||||
[InlineData(ImageType.BMP, "image/bmp")] // BMP image type.
|
||||
[InlineData(ImageType.JPEG, "image/jpeg")] // JPEG image type.
|
||||
[InlineData(ImageType.JPEG_CANON, "image/jpeg")] // Canon JPEG image type.
|
||||
[InlineData(ImageType.SVG, "image/svg+xml")] // SVG image type.
|
||||
[InlineData(ImageType.TGA, "image/x-tga")] // TGA image type.
|
||||
public void GetMimeType_WhenTypeIsKnown_ShouldReturnTheMappedMimeType(ImageType type, string expectedMimeType)
|
||||
{
|
||||
// Act
|
||||
@@ -28,8 +28,8 @@ public class ImageMimeTypesTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(ImageType.None)] // the none image type has no mime mapping
|
||||
[InlineData((ImageType)999)] // an unknown image type has no mime mapping
|
||||
[InlineData(ImageType.None)] // The none image type has no mime mapping.
|
||||
[InlineData((ImageType)999)] // An unknown image type has no mime mapping.
|
||||
public void GetMimeType_WhenTypeIsUnknown_ShouldReturnOpaqueBinaryMimeType(ImageType type)
|
||||
{
|
||||
// Act
|
||||
|
||||
+36
-36
@@ -13,20 +13,20 @@ namespace Lumina.Presentation.Api.UnitTests.Common.MimeTypes;
|
||||
public class MusicMimeTypesTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(AudioFileFormat.MP3, "audio/mpeg")] // mp3 audio format
|
||||
[InlineData(AudioFileFormat.FLAC, "audio/flac")] // flac audio format
|
||||
[InlineData(AudioFileFormat.M4A, "audio/mp4")] // m4a audio format
|
||||
[InlineData(AudioFileFormat.AAC, "audio/aac")] // aac audio format
|
||||
[InlineData(AudioFileFormat.OGG, "audio/ogg")] // ogg audio format
|
||||
[InlineData(AudioFileFormat.OPUS, "audio/ogg")] // opus audio format
|
||||
[InlineData(AudioFileFormat.WAV, "audio/wav")] // wav audio format
|
||||
[InlineData(AudioFileFormat.WMA, "audio/x-ms-wma")] // wma audio format
|
||||
[InlineData(AudioFileFormat.AIFF, "audio/aiff")] // aiff audio format
|
||||
[InlineData(AudioFileFormat.APE, "audio/x-ape")] // ape audio format
|
||||
[InlineData(AudioFileFormat.WAVPACK, "audio/x-wavpack")] // wavpack audio format
|
||||
[InlineData(AudioFileFormat.DSF, "audio/x-dsf")] // dsf audio format
|
||||
[InlineData(AudioFileFormat.DFF, "audio/x-dff")] // dff audio format
|
||||
[InlineData(AudioFileFormat.MATROSKA, "audio/x-matroska")] // matroska audio format
|
||||
[InlineData(AudioFileFormat.MP3, "audio/mpeg")] // MP3 audio format.
|
||||
[InlineData(AudioFileFormat.FLAC, "audio/flac")] // FLAC audio format.
|
||||
[InlineData(AudioFileFormat.M4A, "audio/mp4")] // M4A audio format.
|
||||
[InlineData(AudioFileFormat.AAC, "audio/aac")] // AAC audio format.
|
||||
[InlineData(AudioFileFormat.OGG, "audio/ogg")] // OGG audio format.
|
||||
[InlineData(AudioFileFormat.OPUS, "audio/ogg")] // Opus audio format.
|
||||
[InlineData(AudioFileFormat.WAV, "audio/wav")] // WAV audio format.
|
||||
[InlineData(AudioFileFormat.WMA, "audio/x-ms-wma")] // WMA audio format.
|
||||
[InlineData(AudioFileFormat.AIFF, "audio/aiff")] // AIFF audio format.
|
||||
[InlineData(AudioFileFormat.APE, "audio/x-ape")] // APE audio format.
|
||||
[InlineData(AudioFileFormat.WAVPACK, "audio/x-wavpack")] // WavPack audio format.
|
||||
[InlineData(AudioFileFormat.DSF, "audio/x-dsf")] // DSF audio format.
|
||||
[InlineData(AudioFileFormat.DFF, "audio/x-dff")] // DFF audio format.
|
||||
[InlineData(AudioFileFormat.MATROSKA, "audio/x-matroska")] // Matroska audio format.
|
||||
public void GetMimeType_WhenFormatIsKnown_ShouldReturnMappedMimeType(AudioFileFormat format, string expectedMimeType)
|
||||
{
|
||||
// Act
|
||||
@@ -37,8 +37,8 @@ public class MusicMimeTypesTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(AudioFileFormat.None)] // the none audio format has no mime mapping
|
||||
[InlineData((AudioFileFormat)999)] // an unknown audio format has no mime mapping
|
||||
[InlineData(AudioFileFormat.None)] // The none audio format has no mime mapping.
|
||||
[InlineData((AudioFileFormat)999)] // An unknown audio format has no mime mapping.
|
||||
public void GetMimeType_WhenFormatIsUnknown_ShouldReturnOpaqueBinaryMimeType(AudioFileFormat format)
|
||||
{
|
||||
// Act
|
||||
@@ -49,14 +49,14 @@ public class MusicMimeTypesTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("MP3", "audio/mpeg")] // mp3 container
|
||||
[InlineData("FLAC", "audio/flac")] // flac container
|
||||
[InlineData("MP4", "audio/mp4")] // mp4 container
|
||||
[InlineData("M4A", "audio/mp4")] // m4a container
|
||||
[InlineData("AAC", "audio/aac")] // aac container
|
||||
[InlineData("OGG", "audio/ogg")] // ogg container
|
||||
[InlineData("OPUS", "audio/ogg")] // opus container
|
||||
[InlineData("WAV", "audio/wav")] // wav container
|
||||
[InlineData("MP3", "audio/mpeg")] // MP3 container.
|
||||
[InlineData("FLAC", "audio/flac")] // FLAC container.
|
||||
[InlineData("MP4", "audio/mp4")] // MP4 container.
|
||||
[InlineData("M4A", "audio/mp4")] // M4A container.
|
||||
[InlineData("AAC", "audio/aac")] // AAC container.
|
||||
[InlineData("OGG", "audio/ogg")] // OGG container.
|
||||
[InlineData("OPUS", "audio/ogg")] // Opus container.
|
||||
[InlineData("WAV", "audio/wav")] // WAV container.
|
||||
public void GetContainerMimeType_WhenContainerIsMapped_ShouldReturnMappedMimeType(string container, string expectedMimeType)
|
||||
{
|
||||
// Act
|
||||
@@ -67,10 +67,10 @@ public class MusicMimeTypesTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("mp3", "audio/mpeg")] // lowercase mp3 container
|
||||
[InlineData("Flac", "audio/flac")] // mixed case flac container
|
||||
[InlineData("mP4", "audio/mp4")] // mixed case mp4 container
|
||||
[InlineData("opus", "audio/ogg")] // lowercase opus container
|
||||
[InlineData("mp3", "audio/mpeg")] // Lowercase MP3 container.
|
||||
[InlineData("Flac", "audio/flac")] // Mixed case FLAC container.
|
||||
[InlineData("mP4", "audio/mp4")] // Mixed case MP4 container.
|
||||
[InlineData("opus", "audio/ogg")] // Lowercase Opus container.
|
||||
public void GetContainerMimeType_WhenContainerDiffersInCase_ShouldReturnMappedMimeType(string container, string expectedMimeType)
|
||||
{
|
||||
// Act
|
||||
@@ -81,9 +81,9 @@ public class MusicMimeTypesTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(" MP3 ", "audio/mpeg")] // leading and trailing whitespace around mp3
|
||||
[InlineData("\tOGG", "audio/ogg")] // leading tab around ogg
|
||||
[InlineData("WAV\n", "audio/wav")] // trailing newline around wav
|
||||
[InlineData(" MP3 ", "audio/mpeg")] // Leading and trailing whitespace around MP3.
|
||||
[InlineData("\tOGG", "audio/ogg")] // Leading tab around OGG.
|
||||
[InlineData("WAV\n", "audio/wav")] // Trailing newline around WAV.
|
||||
public void GetContainerMimeType_WhenContainerHasSurroundingWhitespace_ShouldReturnMappedMimeType(string container, string expectedMimeType)
|
||||
{
|
||||
// Act
|
||||
@@ -94,11 +94,11 @@ public class MusicMimeTypesTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null)] // an absent container has no mime mapping
|
||||
[InlineData("")] // an empty container has no mime mapping
|
||||
[InlineData(" ")] // a whitespace only container has no mime mapping
|
||||
[InlineData("WMA")] // a known file format that is not a mapped delivery container
|
||||
[InlineData("not-a-container")] // an unknown container has no mime mapping
|
||||
[InlineData(null)] // An absent container has no mime mapping.
|
||||
[InlineData("")] // An empty container has no mime mapping.
|
||||
[InlineData(" ")] // A whitespace only container has no mime mapping.
|
||||
[InlineData("WMA")] // A known file format that is not a mapped delivery container.
|
||||
[InlineData("not-a-container")] // An unknown container has no mime mapping.
|
||||
public void GetContainerMimeType_WhenContainerIsUnknown_ShouldReturnOpaqueBinaryMimeType(string? container)
|
||||
{
|
||||
// Act
|
||||
|
||||
+7
-7
@@ -43,10 +43,10 @@ public class GetTrackSegmentEndpointTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("MP4", "audio/mp4")] // mp4 delivery container
|
||||
[InlineData("OGG", "audio/ogg")] // ogg delivery container
|
||||
[InlineData("MP3", "audio/mpeg")] // mp3 delivery container
|
||||
[InlineData("not-a-container", "application/octet-stream")] // an unknown delivery container falls back to opaque binary
|
||||
[InlineData("MP4", "audio/mp4")] // MP4 delivery container.
|
||||
[InlineData("OGG", "audio/ogg")] // OGG delivery container.
|
||||
[InlineData("MP3", "audio/mpeg")] // MP3 delivery container.
|
||||
[InlineData("not-a-container", "application/octet-stream")] // An unknown delivery container falls back to opaque binary.
|
||||
public async Task ExecuteAsync_WhenSegmentIsProduced_ShouldReturnDisposingStreamResultWithTheSegment(string container, string expectedContentType)
|
||||
{
|
||||
// Arrange
|
||||
@@ -135,9 +135,9 @@ public class GetTrackSegmentEndpointTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("NotFound", StatusCodes.Status404NotFound)] // the delivery, track or segment does not exist
|
||||
[InlineData("Conflict", StatusCodes.Status409Conflict)] // the delivery changed since the manifest declared it
|
||||
[InlineData("ResourceUnavailable", StatusCodes.Status503ServiceUnavailable)] // the normalization pipeline is temporarily unavailable
|
||||
[InlineData("NotFound", StatusCodes.Status404NotFound)] // The delivery, track or segment does not exist.
|
||||
[InlineData("Conflict", StatusCodes.Status409Conflict)] // The delivery changed since the manifest declared it.
|
||||
[InlineData("ResourceUnavailable", StatusCodes.Status503ServiceUnavailable)] // The normalization pipeline is temporarily unavailable.
|
||||
public async Task ExecuteAsync_WhenHandlerReturnsAProblemError_ShouldReturnTheMappedStatusCode(string errorKind, int expectedStatusCode)
|
||||
{
|
||||
// Arrange
|
||||
|
||||
+4
-4
@@ -75,10 +75,10 @@ public class GetTrackStreamEndpointTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(AudioFileFormat.MP3, "audio/mpeg")] // mp3 audio
|
||||
[InlineData(AudioFileFormat.FLAC, "audio/flac")] // flac audio
|
||||
[InlineData(AudioFileFormat.OGG, "audio/ogg")] // ogg audio
|
||||
[InlineData(AudioFileFormat.None, "application/octet-stream")] // an unrecognized format stays opaque binary
|
||||
[InlineData(AudioFileFormat.MP3, "audio/mpeg")] // MP3 audio.
|
||||
[InlineData(AudioFileFormat.FLAC, "audio/flac")] // FLAC audio.
|
||||
[InlineData(AudioFileFormat.OGG, "audio/ogg")] // OGG audio.
|
||||
[InlineData(AudioFileFormat.None, "application/octet-stream")] // An unrecognized format stays opaque binary.
|
||||
public async Task ExecuteAsync_WhenSuccessful_ShouldServeTheMediaTypeOfTheFormat(AudioFileFormat format, string expectedContentType)
|
||||
{
|
||||
// Arrange
|
||||
|
||||
+12
-12
@@ -115,18 +115,18 @@ public class GetReadingResourceEndpointTests
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("image/png", "image/png")] // a non-svg image is inert content
|
||||
[InlineData("image/svg+xml", "application/octet-stream")] // an svg can be executed, so it is served as an opaque download
|
||||
[InlineData("audio/mpeg", "audio/mpeg")] // audio is inert content
|
||||
[InlineData("video/mp4", "video/mp4")] // video is inert content
|
||||
[InlineData("font/woff2", "font/woff2")] // fonts are inert content
|
||||
[InlineData("application/font-woff", "application/font-woff")] // legacy woff font media type
|
||||
[InlineData("application/font-woff2", "application/font-woff2")] // legacy woff2 font media type
|
||||
[InlineData("application/vnd.ms-opentype", "application/vnd.ms-opentype")] // opentype font media type
|
||||
[InlineData("application/x-font-ttf", "application/x-font-ttf")] // ttf font media type
|
||||
[InlineData("application/x-font-opentype", "application/x-font-opentype")] // otf font media type
|
||||
[InlineData("text/css", "text/css")] // stylesheets are inert content
|
||||
[InlineData("text/html", "application/octet-stream")] // an html document can be executed, so it is served as an opaque download
|
||||
[InlineData("image/png", "image/png")] // A non-svg image is inert content.
|
||||
[InlineData("image/svg+xml", "application/octet-stream")] // An svg can be executed, so it is served as an opaque download.
|
||||
[InlineData("audio/mpeg", "audio/mpeg")] // Audio is inert content.
|
||||
[InlineData("video/mp4", "video/mp4")] // Video is inert content.
|
||||
[InlineData("font/woff2", "font/woff2")] // Fonts are inert content.
|
||||
[InlineData("application/font-woff", "application/font-woff")] // Legacy woff font media type.
|
||||
[InlineData("application/font-woff2", "application/font-woff2")] // Legacy woff2 font media type.
|
||||
[InlineData("application/vnd.ms-opentype", "application/vnd.ms-opentype")] // Opentype font media type.
|
||||
[InlineData("application/x-font-ttf", "application/x-font-ttf")] // Ttf font media type.
|
||||
[InlineData("application/x-font-opentype", "application/x-font-opentype")] // Otf font media type.
|
||||
[InlineData("text/css", "text/css")] // Stylesheets are inert content.
|
||||
[InlineData("text/html", "application/octet-stream")] // An html document can be executed, so it is served as an opaque download.
|
||||
public async Task ExecuteAsync_WhenServingAResource_ShouldUseTheSafeContentType(string mimeType, string expectedContentType)
|
||||
{
|
||||
// Arrange
|
||||
|
||||
+1
-1
@@ -170,7 +170,7 @@ public class InstallPluginEndpointTests
|
||||
|
||||
private void ConfigureFormWithArchive(byte[] content, string fileName)
|
||||
{
|
||||
// the stream stays open for the duration of the test, since the endpoint reads it through the form file during execution
|
||||
// The stream stays open for the duration of the test, since the endpoint reads it through the form file during execution.
|
||||
MemoryStream archiveStream = new(content);
|
||||
IFormFile formFile = new FormFile(archiveStream, 0, content.Length, "archive", fileName);
|
||||
FormFileCollection files = [formFile];
|
||||
|
||||
+1
-1
@@ -181,7 +181,7 @@ public class InstallThemeEndpointTests
|
||||
|
||||
private void ConfigureFormWithArchive(byte[] content, string fileName)
|
||||
{
|
||||
// the stream stays open for the duration of the test, since the endpoint reads it through the form file during execution
|
||||
// The stream stays open for the duration of the test, since the endpoint reads it through the form file during execution.
|
||||
MemoryStream archiveStream = new(content);
|
||||
IFormFile formFile = new FormFile(archiveStream, 0, content.Length, "archive", fileName);
|
||||
FormFileCollection files = [formFile];
|
||||
|
||||
Reference in new issue
Block a user