Created
October 25, 2019 07:00
-
-
Save neilharvey/d12c66505ff31d3a101bf58ee85d918e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using FileSignatures.Formats; | |
| using Microsoft.Extensions.DependencyInjection; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.IO; | |
| using System.Text; | |
| using Xunit; | |
| namespace FileSignatures.Tests | |
| { | |
| public class RegistrationTests | |
| { | |
| [Fact] | |
| public void CanBeRegisteredAsSingleton() | |
| { | |
| var services = new ServiceCollection(); | |
| services.AddSingleton<IFileFormatInspector>(x => new FileFormatInspector()); | |
| var provider = services.BuildServiceProvider(); | |
| var jpegHeader = new byte[] { 0xFF, 0xD8 }; | |
| using var stream = new MemoryStream(jpegHeader); | |
| var inspector = provider.GetService<IFileFormatInspector>(); | |
| var result = inspector.DetermineFileFormat(stream); | |
| Assert.NotNull(result); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment