mirror of
https://github.com/ZuneDev/ZuneUIXTools.git
synced 2026-07-27 13:11:59 -07:00
Add Assembler tests
This commit is contained in:
@@ -5,23 +5,24 @@ namespace UIX.Test.Helpers;
|
||||
|
||||
internal class TempFile : IDisposable, IAsyncInit
|
||||
{
|
||||
private const string _defaultFileExtension = ".tmp";
|
||||
private readonly Func<Task> _init;
|
||||
|
||||
public TempFile(System.Resources.ResourceManager resourceManager, string resourceName)
|
||||
: this((byte[])resourceManager.GetObject(resourceName)!)
|
||||
public TempFile(System.Resources.ResourceManager resourceManager, string resourceName, string fileExtension = _defaultFileExtension)
|
||||
: this((byte[])resourceManager.GetObject(resourceName)!, fileExtension)
|
||||
{
|
||||
}
|
||||
|
||||
public TempFile(string resourceName) : this(TestResources.ResourceManager, resourceName)
|
||||
public TempFile(string resourceName, string fileExtension = _defaultFileExtension) : this(TestResources.ResourceManager, resourceName, fileExtension)
|
||||
{
|
||||
}
|
||||
|
||||
public TempFile(byte[] data)
|
||||
public TempFile(byte[] data, string fileExtension = _defaultFileExtension)
|
||||
{
|
||||
_init = async delegate
|
||||
{
|
||||
// Copy the test data to a temporary file because Iris can only load from a URI.
|
||||
Path = System.IO.Path.GetTempFileName();
|
||||
Path = System.IO.Path.ChangeExtension(System.IO.Path.GetTempFileName(), fileExtension);
|
||||
await File.WriteAllBytesAsync(Path, data);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user