public void TestSerializationForNotaryContentTrust() { NotaryContentTrust notaryContentTrust = new NotaryContentTrust { RootJsonPath = "/home/path/module/rootjson", RootID = "45634232423523232423423525253252532523432333", RootCertificatePath = "/home/path/module/rootca", DisableTOFU = true }; DockerConfig config = new DockerConfig("image1:42", "{}", Option.Maybe(notaryContentTrust)); string json = JsonConvert.SerializeObject(config); string expected = "{\"image\":\"image1:42\",\"createOptions\":\"{}\",\"notaryContentTrust\":{\"rootJsonPath\":\"/home/path/module/rootjson\",\"rootID\":\"45634232423523232423423525253252532523432333\",\"rootCertificatePath\":\"/home/path/module/rootca\",\"disableTOFU\":true}}"; Assert.Equal(expected, json); }
public void TestDeserializationForNotaryContentTrustDefaultValue() { string testConfig = @" { 'image': 'image1:42', 'createOptions' : ""{}"", 'notaryContentTrust' : {} }"; NotaryContentTrust notaryContentTrust = new NotaryContentTrust { DisableTOFU = false }; DockerConfig config = new DockerConfig("image1:42", "{}", Option.Maybe(notaryContentTrust)); DockerConfig expectedConfig = JsonConvert.DeserializeObject <DockerConfig>(testConfig); Assert.Equal(expectedConfig, config); }
public void TestDeserializationForNotaryContentTrust() { string testConfig = @" { 'image': 'image1:42', 'createOptions' : ""{}"", 'notaryContentTrust' : { 'rootJsonPath' : '/home/path/module/rootjson', 'rootID' : '45634232423523232423423525253252532523432333', 'rootCertificatePath' : '/home/path/module/rootca', 'disableTOFU': 'true'} }"; NotaryContentTrust notaryContentTrust = new NotaryContentTrust { RootJsonPath = "/home/path/module/rootjson", RootID = "45634232423523232423423525253252532523432333", RootCertificatePath = "/home/path/module/rootca", DisableTOFU = true }; DockerConfig config = new DockerConfig("image1:42", "{}", Option.Maybe(notaryContentTrust)); DockerConfig expectedConfig = JsonConvert.DeserializeObject <DockerConfig>(testConfig); Assert.Equal(expectedConfig, config); }