public async Task Create_Works_Async() { var disk = new DeveloperDisk() { Image = new MemoryStream(Encoding.UTF8.GetBytes("Hello, world!")), Signature = new byte[] { 1, 2, 3, 4 }, Version = new SystemVersion() { BuildID = new Guid("5abf1921-e3e3-4bfc-94c5-6c6805f23815"), ProductBuildVersion = new AppleVersion(1, 'A', 1), ProductCopyright = "Quamotion bv", ProductName = "Kaponata", ProductVersion = new Version(1, 0), }, CreationTime = new DateTimeOffset(2000, 1, 1, 0, 0, 0, 0, TimeSpan.Zero), }; var factory = new DeveloperDiskRegistryImageFactory(); (var manifest, var configStream, var layerStream) = await factory.CreateRegistryImageAsync(disk, default).ConfigureAwait(false); Assert.NotNull(manifest); Assert.NotNull(configStream); Assert.Equal(0, configStream.Position); Assert.NotEqual(0, configStream.Length); Assert.NotNull(layerStream); Assert.Equal(0, layerStream.Position); Assert.NotEqual(0, layerStream.Length); var config = await JsonSerializer.DeserializeAsync <Image>(configStream, default).ConfigureAwait(false); // The RootFS is a Tar archive which contains the developer disk image, signature and a copy of the SystemVersion.plist file var reader = new TarReader(layerStream); (TarHeader? header, Stream entryStream) = await reader.ReadAsync(default).ConfigureAwait(false);
public async Task Create_ValidatesArguments_Async() { var factory = new DeveloperDiskRegistryImageFactory(); await Assert.ThrowsAsync <ArgumentNullException>(() => factory.CreateRegistryImageAsync(null, default)); }