예제 #1
0
        public async Task FromFileAsync_ValidatesArguments_Async()
        {
            var factory = new DeveloperDiskFactory();
            await Assert.ThrowsAsync <ArgumentNullException>(() => factory.FromFileAsync(null, Stream.Null, default));

            await Assert.ThrowsAsync <ArgumentNullException>(() => factory.FromFileAsync(Stream.Null, null, default));
        }
예제 #2
0
        public async Task FromFileAsync_Works_Async()
        {
            using (Stream stream = File.OpenRead("TestAssets/udro-hfsplus.dmg"))
                using (MemoryStream signature = new MemoryStream(new byte[] { 1, 2, 3, 4 }))
                {
                    var factory = new DeveloperDiskFactory();
                    var disk    = await factory.FromFileAsync(stream, signature, default).ConfigureAwait(false);

                    Assert.Same(stream, disk.Image);
                    Assert.Equal(new byte[] { 1, 2, 3, 4 }, disk.Signature);
                    Assert.NotNull(disk.Version);
                    Assert.Equal("17E255", disk.Version.ProductBuildVersion.ToString());
                }
        }