Skip to content

Commit cc3a1d1

Browse files
committed
Added media type constants (#43)
1 parent cb4dd89 commit cc3a1d1

File tree

3 files changed

+129
-1
lines changed

3 files changed

+129
-1
lines changed

src/MyWebApi.Tests/BuildersTests/HttpActionResultsTests/ContentTests/ContentTestBuilderTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,5 @@ public void WithResponseModelOfTypeShouldWorkCorrectly()
292292
.Content()
293293
.WithResponseModelOfType<ICollection<ResponseModel>>();
294294
}
295-
296295
}
297296
}

src/MyWebApi/MediaType.cs

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
// MyWebApi - ASP.NET Web API Fluent Testing Framework
2+
// Copyright (C) 2015 Ivaylo Kenov.
3+
//
4+
// This program is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// This program is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU General Public License
15+
// along with this program. If not, see http://www.gnu.org/licenses/.
16+
17+
namespace MyWebApi
18+
{
19+
using System.Diagnostics.CodeAnalysis;
20+
21+
/// <summary>
22+
/// Contains common MIME type values.
23+
/// </summary>
24+
public static class MediaType
25+
{
26+
/// <summary>
27+
/// Represents text/plain (txt).
28+
/// </summary>
29+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
30+
public const string TextPlain = "text/plain";
31+
32+
/// <summary>
33+
/// Represents text/html (html).
34+
/// </summary>
35+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
36+
public const string TextHtml = "text/html";
37+
38+
/// <summary>
39+
/// Represents text/css (css).
40+
/// </summary>
41+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
42+
public const string TextCss = "text/css";
43+
44+
/// <summary>
45+
/// Represents image/bmp (bmp).
46+
/// </summary>
47+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
48+
public const string ImageBmp = "image/bmp";
49+
50+
/// <summary>
51+
/// Represents image/jpeg (jpeg or jpg).
52+
/// </summary>
53+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
54+
public const string ImageJpeg = "image/jpeg";
55+
56+
/// <summary>
57+
/// Represents image/png (png).
58+
/// </summary>
59+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
60+
public const string ImagePng = "image/png";
61+
62+
/// <summary>
63+
/// Represents image/gif (gif).
64+
/// </summary>
65+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
66+
public const string ImageGif = "image/gif";
67+
68+
/// <summary>
69+
/// Represents "application/x-javascript" (js).
70+
/// </summary>
71+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
72+
public const string ApplicationJavaScript = "application/x-javascript";
73+
74+
/// <summary>
75+
/// Represents application/json (json).
76+
/// </summary>
77+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
78+
public const string ApplicationJson = "application/json";
79+
80+
/// <summary>
81+
/// Represents application/xml (xml).
82+
/// </summary>
83+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
84+
public const string ApplicationXml = "application/xml";
85+
86+
/// <summary>
87+
/// Represents application/octet-stream (exe).
88+
/// </summary>
89+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
90+
public const string ApplicationOctetStream = "application/octet-stream";
91+
92+
/// <summary>
93+
/// Represents application/zip (zip).
94+
/// </summary>
95+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
96+
public const string ApplicationZip = "application/zip";
97+
98+
/// <summary>
99+
/// Represents audio/mpeg (mp3).
100+
/// </summary>
101+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
102+
public const string AudioMpeg = "audio/mpeg";
103+
104+
/// <summary>
105+
/// Represents audio/vorbis (ogg).
106+
/// </summary>
107+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
108+
public const string AudioVorbis = "audio/vorbis";
109+
110+
/// <summary>
111+
/// Represents video/avi (avi).
112+
/// </summary>
113+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
114+
public const string VideoAvi = "video/avi";
115+
116+
/// <summary>
117+
/// Represents video/mpeg (mpeg).
118+
/// </summary>
119+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
120+
public const string VideoMpeg = "video/mpeg";
121+
122+
/// <summary>
123+
/// Represents video/quicktime (qt).
124+
/// </summary>
125+
[SuppressMessage("Microsoft.StyleCop.CSharp.DocumentationRules", "*", Justification = "MIME types are not recognised by the spelling checker.")]
126+
public const string VideoQuicktime = "video/quicktime";
127+
}
128+
}

src/MyWebApi/MyWebApi.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@
172172
<Compile Include="Exceptions\UnauthorizedResultAssertionException.cs" />
173173
<Compile Include="Exceptions\UnresolvedDependenciesException.cs" />
174174
<Compile Include="Exceptions\RedirectResultAssertionException.cs" />
175+
<Compile Include="MediaType.cs" />
175176
<Compile Include="MyWebApi.cs" />
176177
<Compile Include="Properties\AssemblyInfo.cs" />
177178
<Compile Include="Utilities\ExpressionParser.cs" />

0 commit comments

Comments
 (0)