Fix bugs in BSA tests after async IO conversion

This commit is contained in:
Timothy Baldridge 2020-05-25 22:17:23 -06:00
parent e47f80eff6
commit 619da2fa86

View File

@ -141,22 +141,22 @@ namespace Compression.BSA.Test
await a.Files.Zip(b.Files, (ai, bi) => (ai, bi))
.PMap(Queue, pair =>
.PMap(Queue, async pair =>
{
Assert.Equal(pair.ai.State.ToJson(), pair.bi.State.ToJson());
//Console.WriteLine($" - {pair.ai.Path}");
Assert.Equal(pair.ai.Path, pair.bi.Path);
//Equal(pair.ai.Compressed, pair.bi.Compressed);
Assert.Equal(pair.ai.Size, pair.bi.Size);
Assert.Equal(GetData(pair.ai), GetData(pair.bi));
Assert.Equal(await GetData(pair.ai), await GetData(pair.bi));
});
}
}
private static byte[] GetData(IFile pairAi)
private static async ValueTask<byte[]> GetData(IFile pairAi)
{
using var ms = new MemoryStream();
pairAi.CopyDataTo(ms);
await using var ms = new MemoryStream();
await pairAi.CopyDataTo(ms);
return ms.ToArray();
}