Skip to content

Commit

Permalink
Add common MIME types from MDN (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
markwhitaker authored Sep 19, 2022
1 parent 2900a2c commit e4b0257
Show file tree
Hide file tree
Showing 10 changed files with 258 additions and 23 deletions.
35 changes: 32 additions & 3 deletions MimeTypes.Tests/ApplicationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ public class ApplicationTests
[TestCase(MimeType.Application.AtomXml, "application/atom+xml")]
[TestCase(MimeType.Application.AtomcatXml, "application/atomcat+xml")]
[TestCase(MimeType.Application.Ecmascript, "application/ecmascript")]
[TestCase(MimeType.Application.EpubZip, "application/epub+zip")]
[TestCase(MimeType.Application.Gzip, "application/gzip")]
[TestCase(MimeType.Application.JavaArchive, "application/java-archive")]
[TestCase(MimeType.Application.Javascript, "application/javascript")]
[TestCase(MimeType.Application.Json, "application/json")]
[TestCase(MimeType.Application.LdJson, "application/ld+json")]
[TestCase(MimeType.Application.Mp4, "application/mp4")]
[TestCase(MimeType.Application.Msword, "application/msword")]
[TestCase(MimeType.Application.OctetStream, "application/octet-stream")]
[TestCase(MimeType.Application.Ogg, "application/ogg")]
[TestCase(MimeType.Application.Pdf, "application/pdf")]
[TestCase(MimeType.Application.Pkcs10, "application/pkcs10")]
[TestCase(MimeType.Application.Pkcs7Mime, "application/pkcs7-mime")]
Expand All @@ -23,16 +28,40 @@ public class ApplicationTests
[TestCase(MimeType.Application.RssXml, "application/rss+xml")]
[TestCase(MimeType.Application.Rtf, "application/rtf")]
[TestCase(MimeType.Application.SmilXml, "application/smil+xml")]
[TestCase(MimeType.Application.VndAmazonEbook, "application/vnd.amazon.ebook")]
[TestCase(MimeType.Application.VndAppleInstallerXml, "application/vnd.apple.installer+xml")]
[TestCase(MimeType.Application.VndMozillaXulXml, "application/vnd.mozilla.xul+xml")]
[TestCase(MimeType.Application.VndMsExcel, "application/vnd.ms-excel")]
[TestCase(MimeType.Application.VndMsFontobject, "application/vnd.ms-fontobject")]
[TestCase(MimeType.Application.VndMsPowerpoint, "application/vnd.ms-powerpoint")]
[TestCase(MimeType.Application.VndOasisOpendocumentPresentation, "application/vnd.oasis.opendocument.presentation")]
[TestCase(MimeType.Application.VndOasisOpendocumentSpreadsheet, "application/vnd.oasis.opendocument.spreadsheet")]
[TestCase(MimeType.Application.VndOasisOpendocumentText, "application/vnd.oasis.opendocument.text")]
[TestCase(MimeType.Application.VndOpenxmlformatsOfficedocumentPresentationmlPresentation, "application/vnd.openxmlformats-officedocument.presentationml.presentation")]
[TestCase(MimeType.Application.VndOpenxmlformatsOfficedocumentSpreadsheetmlSheet, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")]
[TestCase(MimeType.Application.VndOpenxmlformatsOfficedocumentWordprocessingmlDocument, "application/vnd.openxmlformats-officedocument.wordprocessingml.document")]
[TestCase(MimeType.Application.VndRar, "application/vnd.rar")]
[TestCase(MimeType.Application.VndVisio, "application/vnd.visio")]
[TestCase(MimeType.Application.X7zCompressed, "application/x-7z-compressed")]
[TestCase(MimeType.Application.XAbiword, "application/x-abiword")]
[TestCase(MimeType.Application.XBzip, "application/x-bzip")]
[TestCase(MimeType.Application.XBzip2, "application/x-bzip2")]
[TestCase(MimeType.Application.XCdf, "application/x-cdf")]
[TestCase(MimeType.Application.XCsh, "application/x-csh")]
[TestCase(MimeType.Application.XFontOtf, "application/x-font-otf")]
[TestCase(MimeType.Application.XFontTtf, "application/x-font-ttf")]
[TestCase(MimeType.Application.XFontWoff, "application/x-font-woff")]
[TestCase(MimeType.Application.XPkcs12, "application/x-pkcs12")]
[TestCase(MimeType.Application.XShockwaveFlash, "application/x-shockwave-flash")]
[TestCase(MimeType.Application.XSilverlightApp, "application/x-silverlight-app")]
[TestCase(MimeType.Application.XFreearc, "application/x-freearc")]
[TestCase(MimeType.Application.XhtmlXml, "application/xhtml+xml")]
[TestCase(MimeType.Application.XHttpdPhp, "application/x-httpd-php")]
[TestCase(MimeType.Application.Xml, "application/xml")]
[TestCase(MimeType.Application.XmlDtd, "application/xml-dtd")]
[TestCase(MimeType.Application.XPkcs12, "application/x-pkcs12")]
[TestCase(MimeType.Application.XSh, "application/x-sh")]
[TestCase(MimeType.Application.XShockwaveFlash, "application/x-shockwave-flash")]
[TestCase(MimeType.Application.XSilverlightApp, "application/x-silverlight-app")]
[TestCase(MimeType.Application.XsltXml, "application/xslt+xml")]
[TestCase(MimeType.Application.XTar, "application/x-tar")]
[TestCase(MimeType.Application.XWwwFormUrlencoded, "application/x-www-form-urlencoded")]
[TestCase(MimeType.Application.Zip, "application/zip")]
public void AssertApplicationMimeTypeValue(string valueUnderTest, string expectedValue)
Expand Down
6 changes: 5 additions & 1 deletion MimeTypes.Tests/AudioTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ public class AudioTests
[TestCase(MimeType.Audio.Mp4, "audio/mp4")]
[TestCase(MimeType.Audio.Mpeg, "audio/mpeg")]
[TestCase(MimeType.Audio.Ogg, "audio/ogg")]
[TestCase(MimeType.Audio.Opus, "audio/opus")]
[TestCase(MimeType.Audio.Threegpp, "audio/3gpp")]
[TestCase(MimeType.Audio.Threegpp2, "audio/3gpp2")]
[TestCase(MimeType.Audio.Wav, "audio/wav")]
[TestCase(MimeType.Audio.Webm, "audio/webm")]
[TestCase(MimeType.Audio.XAac, "audio/x-aac")]
[TestCase(MimeType.Audio.XAiff, "audio/x-aiff")]
[TestCase(MimeType.Audio.XMidi, "audio/x-midi")]
[TestCase(MimeType.Audio.XMpegurl, "audio/x-mpegurl")]
[TestCase(MimeType.Audio.XMsWma, "audio/x-ms-wma")]
[TestCase(MimeType.Audio.XWav, "audio/x-wav")]
public void AssertAudioMimeTypeValue(string valueUnderTest, string expectedValue)
{
Assert.That(valueUnderTest, Is.EqualTo(expectedValue));
}
}
}
4 changes: 3 additions & 1 deletion MimeTypes.Tests/ImageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ namespace Mainwave.MimeTypes.Tests;
[TestFixture]
public class ImageTests
{
[TestCase(MimeType.Image.Avif, "image/avif")]
[TestCase(MimeType.Image.Bmp, "image/bmp")]
[TestCase(MimeType.Image.Gif, "image/gif")]
[TestCase(MimeType.Image.Jpeg, "image/jpeg")]
[TestCase(MimeType.Image.Png, "image/png")]
[TestCase(MimeType.Image.SvgXml, "image/svg+xml")]
[TestCase(MimeType.Image.Tiff, "image/tiff")]
[TestCase(MimeType.Image.VndMicrosoftIcon, "image/vnd.microsoft.icon")]
[TestCase(MimeType.Image.Webp, "image/webp")]
public void AssertImageMimeTypeValue(string valueUnderTest, string expectedValue)
{
Assert.That(valueUnderTest, Is.EqualTo(expectedValue));
}
}
}
3 changes: 2 additions & 1 deletion MimeTypes.Tests/TextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Mainwave.MimeTypes.Tests;
[TestFixture]
public class TextTests
{
[TestCase(MimeType.Text.Calendar, "text/calendar")]
[TestCase(MimeType.Text.Css, "text/css")]
[TestCase(MimeType.Text.Csv, "text/csv")]
[TestCase(MimeType.Text.Html, "text/html")]
Expand All @@ -18,4 +19,4 @@ public void AssertTextMimeTypeValue(string valueUnderTest, string expectedValue)
{
Assert.That(valueUnderTest, Is.EqualTo(expectedValue));
}
}
}
7 changes: 5 additions & 2 deletions MimeTypes.Tests/VideoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ namespace Mainwave.MimeTypes.Tests;
[TestFixture]
public class VideoTests
{
[TestCase(MimeType.Video.Threegpp, "video/3gpp")]
[TestCase(MimeType.Video.H264, "video/h264")]
[TestCase(MimeType.Video.Mp2t, "video/mp2t")]
[TestCase(MimeType.Video.Mp4, "video/mp4")]
[TestCase(MimeType.Video.Mpeg, "video/mpeg")]
[TestCase(MimeType.Video.Ogg, "video/ogg")]
[TestCase(MimeType.Video.Quicktime, "video/quicktime")]
[TestCase(MimeType.Video.Threegpp, "video/3gpp")]
[TestCase(MimeType.Video.Threegpp2, "video/3gpp2")]
[TestCase(MimeType.Video.Webm, "video/webm")]
[TestCase(MimeType.Video.XMsvideo, "video/x-msvideo")]
public void AssertVideoMimeTypeValue(string valueUnderTest, string expectedValue)
{
Assert.That(valueUnderTest, Is.EqualTo(expectedValue));
}
}
}
167 changes: 156 additions & 11 deletions MimeTypes/MimeType.Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ public static class Application
/// </summary>
public const string Ecmascript = Prefix + "ecmascript";

/// <summary>
/// application/epub+zip
/// </summary>
public const string EpubZip = Prefix + "epub+zip";

/// <summary>
/// application/gzip
/// </summary>
public const string Gzip = Prefix + "gzip";

/// <summary>
/// application/java-archive
/// </summary>
Expand All @@ -39,16 +49,31 @@ public static class Application
/// </summary>
public const string Json = Prefix + "json";

/// <summary>
/// application/ld+json
/// </summary>
public const string LdJson = Prefix + "ld+json";

/// <summary>
/// application/mp4
/// </summary>
public const string Mp4 = Prefix + "mp4";

/// <summary>
/// application/msword
/// </summary>
public const string Msword = Prefix + "msword";

/// <summary>
/// application/octet-stream
/// </summary>
public const string OctetStream = Prefix + "octet-stream";

/// <summary>
/// application/ogg
/// </summary>
public const string Ogg = Prefix + "ogg";

/// <summary>
/// application/pdf
/// </summary>
Expand Down Expand Up @@ -99,6 +124,106 @@ public static class Application
/// </summary>
public const string SmilXml = Prefix + "smil+xml";

/// <summary>
/// application/vnd.amazon.ebook
/// </summary>
public const string VndAmazonEbook = Prefix + "vnd.amazon.ebook";

/// <summary>
/// application/vnd.apple.installer+xml
/// </summary>
public const string VndAppleInstallerXml = Prefix + "vnd.apple.installer+xml";

/// <summary>
/// application/vnd.mozilla.xul+xml
/// </summary>
public const string VndMozillaXulXml = Prefix + "vnd.mozilla.xul+xml";

/// <summary>
/// application/vnd.ms-excel
/// </summary>
public const string VndMsExcel = Prefix + "vnd.ms-excel";

/// <summary>
/// application/vnd.ms-fontobject
/// </summary>
public const string VndMsFontobject = Prefix + "vnd.ms-fontobject";

/// <summary>
/// application/vnd.ms-powerpoint
/// </summary>
public const string VndMsPowerpoint = Prefix + "vnd.ms-powerpoint";

/// <summary>
/// application/vnd.oasis.opendocument.presentation
/// </summary>
public const string VndOasisOpendocumentPresentation = Prefix + "vnd.oasis.opendocument.presentation";

/// <summary>
/// application/vnd.oasis.opendocument.spreadsheet
/// </summary>
public const string VndOasisOpendocumentSpreadsheet = Prefix + "vnd.oasis.opendocument.spreadsheet";

/// <summary>
/// application/vnd.oasis.opendocument.text
/// </summary>
public const string VndOasisOpendocumentText = Prefix + "vnd.oasis.opendocument.text";

/// <summary>
/// application/vnd.openxmlformats-officedocument.presentationml.presentation
/// </summary>
public const string VndOpenxmlformatsOfficedocumentPresentationmlPresentation = Prefix + "vnd.openxmlformats-officedocument.presentationml.presentation";

/// <summary>
/// application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
/// </summary>
public const string VndOpenxmlformatsOfficedocumentSpreadsheetmlSheet = Prefix + "vnd.openxmlformats-officedocument.spreadsheetml.sheet";

/// <summary>
/// application/vnd.openxmlformats-officedocument.wordprocessingml.document
/// </summary>
public const string VndOpenxmlformatsOfficedocumentWordprocessingmlDocument = Prefix + "vnd.openxmlformats-officedocument.wordprocessingml.document";

/// <summary>
/// application/vnd.rar
/// </summary>
public const string VndRar = Prefix + "vnd.rar";

/// <summary>
/// application/vnd.visio
/// </summary>
public const string VndVisio = Prefix + "vnd.visio";

/// <summary>
/// application/x-7z-compressed
/// </summary>
public const string X7zCompressed = Prefix + "x-7z-compressed";

/// <summary>
/// application/x-abiword
/// </summary>
public const string XAbiword = Prefix + "x-abiword";

/// <summary>
/// application/x-bzip
/// </summary>
public const string XBzip = Prefix + "x-bzip";

/// <summary>
/// application/x-bzip2
/// </summary>
public const string XBzip2 = Prefix + "x-bzip2";

/// <summary>
/// application/x-cdf
/// </summary>
public const string XCdf = Prefix + "x-cdf";

/// <summary>
/// application/x-csh
/// </summary>
public const string XCsh = Prefix + "x-csh";

/// <summary>
/// application/x-font-otf
/// </summary>
Expand All @@ -115,24 +240,19 @@ public static class Application
public const string XFontWoff = Prefix + "x-font-woff";

/// <summary>
/// application/x-pkcs12
/// application/x-freearc
/// </summary>
public const string XPkcs12 = Prefix + "x-pkcs12";

/// <summary>
/// application/x-shockwave-flash
/// </summary>
public const string XShockwaveFlash = Prefix + "x-shockwave-flash";
public const string XFreearc = Prefix + "x-freearc";

/// <summary>
/// application/x-silverlight-app
/// application/xhtml+xml
/// </summary>
public const string XSilverlightApp = Prefix + "x-silverlight-app";
public const string XhtmlXml = Prefix + "xhtml+xml";

/// <summary>
/// application/xhtml+xml
/// application/x-httpd-php
/// </summary>
public const string XhtmlXml = Prefix + "xhtml+xml";
public const string XHttpdPhp = Prefix + "x-httpd-php";

/// <summary>
/// application/xml
Expand All @@ -144,11 +264,36 @@ public static class Application
/// </summary>
public const string XmlDtd = Prefix + "xml-dtd";

/// <summary>
/// application/x-pkcs12
/// </summary>
public const string XPkcs12 = Prefix + "x-pkcs12";

/// <summary>
/// application/x-sh
/// </summary>
public const string XSh = Prefix + "x-sh";

/// <summary>
/// application/x-shockwave-flash
/// </summary>
public const string XShockwaveFlash = Prefix + "x-shockwave-flash";

/// <summary>
/// application/x-silverlight-app
/// </summary>
public const string XSilverlightApp = Prefix + "x-silverlight-app";

/// <summary>
/// application/xslt+xml
/// </summary>
public const string XsltXml = Prefix + "xslt+xml";

/// <summary>
/// application/x-tar
/// </summary>
public const string XTar = Prefix + "x-tar";

/// <summary>
/// application/x-www-form-urlencoded
/// </summary>
Expand Down
20 changes: 20 additions & 0 deletions MimeTypes/MimeType.Audio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ public static class Audio
/// </summary>
public const string Ogg = Prefix + "ogg";

/// <summary>
/// audio/opus
/// </summary>
public const string Opus = Prefix + "opus";

/// <summary>
/// audio/3gpp
/// </summary>
public const string Threegpp = Prefix + "3gpp";

/// <summary>
/// audio/3gpp2
/// </summary>
public const string Threegpp2 = Prefix + "3gpp2";

/// <summary>
/// audio/wav
/// </summary>
Expand All @@ -49,6 +64,11 @@ public static class Audio
/// </summary>
public const string XAiff = Prefix + "x-aiff";

/// <summary>
/// audio/x-midi
/// </summary>
public const string XMidi = Prefix + "x-midi";

/// <summary>
/// audio/x-mpegurl
/// </summary>
Expand Down
Loading

0 comments on commit e4b0257

Please sign in to comment.