DescriptorTests.cs 957 B

1234567891011121314151617181920212223242526272829
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. using System.Text.Json;
  4. namespace Microsoft.NET.Build.Containers.UnitTests;
  5. public class DescriptorTests
  6. {
  7. [Fact]
  8. public void BasicConstructor()
  9. {
  10. Descriptor d = new(
  11. mediaType: "application/vnd.oci.image.manifest.v1+json",
  12. digest: "sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270",
  13. size: 7682);
  14. Console.WriteLine(JsonSerializer.Serialize(d, new JsonSerializerOptions { WriteIndented = true }));
  15. Assert.Equal("application/vnd.oci.image.manifest.v1+json", d.MediaType);
  16. Assert.Equal("sha256:5b0bcabd1ed22e9fb1310cf6c2dec7cdef19f0ad69efa1f392e94a4333501270", d.Digest);
  17. Assert.Equal(7_682, d.Size);
  18. Assert.Null(d.Annotations);
  19. Assert.Null(d.Data);
  20. Assert.Null(d.Urls);
  21. }
  22. }