This commit is contained in:
55
e2e/csharp/tests/MimeUtilitiesTests.cs
generated
Normal file
55
e2e/csharp/tests/MimeUtilitiesTests.cs
generated
Normal file
@@ -0,0 +1,55 @@
|
||||
// This file is auto-generated by alef — DO NOT EDIT.
|
||||
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
|
||||
// To regenerate: alef generate
|
||||
// To verify freshness: alef verify --exit-code
|
||||
// Issues & docs: https://github.com/kreuzberg-dev/alef
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using Kreuzberg;
|
||||
using static Kreuzberg.KreuzbergLib;
|
||||
|
||||
namespace Kreuzberg
|
||||
{
|
||||
/// <summary>E2e tests for category: mime_utilities.</summary>
|
||||
public class MimeUtilitiesTests
|
||||
{
|
||||
private static readonly JsonSerializerOptions ConfigOptions = new() { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.SnakeCaseLower) }, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault };
|
||||
|
||||
[Fact]
|
||||
public void Test_MimeDetectBytes()
|
||||
{
|
||||
// Detect MIME type from file bytes
|
||||
var result = KreuzbergLib.DetectMimeTypeFromBytes(System.IO.File.ReadAllBytes("pdf/fake_memo.pdf"));
|
||||
Assert.Contains("pdf", result.ToString().ToLower());
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Test_MimeDetectImage()
|
||||
{
|
||||
// Detect MIME type from PNG image bytes
|
||||
var result = KreuzbergLib.DetectMimeTypeFromBytes(System.IO.File.ReadAllBytes("images/test_hello_world.png"));
|
||||
Assert.Contains("png", result.ToString().ToLower());
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Test_MimeGetExtensions()
|
||||
{
|
||||
// Get file extensions for a MIME type
|
||||
var result = KreuzbergLib.GetExtensionsForMime("application/pdf");
|
||||
Assert.Contains("pdf", JsonSerializer.Serialize(result).ToLower());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user