ReMime/ReMime.Tests/MediaTypesByExtension.cs

32 lines
910 B
C#
Raw Normal View History

using System.Runtime.CompilerServices;
using ReMime.Platform;
namespace ReMime.Tests
{
2024-08-30 18:15:45 +02:00
[TestClass]
public class MediaTypesByExtension
{
readonly (string extension, string type)[] ExampleMimeTypes = new (string, string)[] {
("png", "image/png"),
("gif", "image/gif"),
("jpeg", "image/jpeg"),
("jpg", "image/jpeg"),
("txt", "text/plain"),
("css", "text/css"),
("mp4", "video/mp4"),
("ttf", "font/ttf")
};
[TestMethod]
public void PassKnownTypes()
{
foreach (var(ext, type) in ExampleMimeTypes)
{
2024-08-30 18:15:45 +02:00
Assert.IsTrue(MediaTypeResolver.TryResolve(ext, out MediaType? result));
Assert.AreEqual(result!.FullType, type);
Assert.IsTrue(result.Extensions.Contains(ext));
}
}
}
}