Пример #1
0
        public void GetData_ReturnsValue()
        {
            var entry = new byte[] { 1, 2, 3, 4 };
            var dict  = new NSDictionary();

            dict.Add("key", new NSData(entry));

            var value = dict.GetData("key");

            Assert.Equal(entry, value);
        }
Пример #2
0
 /// <summary>
 /// Reads a <see cref="PairingRecord"/> from a <see cref="NSDictionary"/>.
 /// </summary>
 /// <param name="dict">
 /// The <see cref="NSDictionary"/> which represents the pairing record.
 /// </param>
 /// <returns>
 /// An equivalent <see cref="PairingRecord"/> object.
 /// </returns>
 public static PairingRecord Read(NSDictionary dict)
 {
     return(new PairingRecord()
     {
         WiFiMacAddress = dict.GetString("WiFiMACAddress"),
         EscrowBag = dict.GetData("EscrowBag"),
         SystemBUID = dict.GetString("SystemBUID"),
         HostId = dict.GetString("HostID"),
         RootCertificate = new X509Certificate2(dict.GetData("RootCertificate")),
         HostCertificate = new X509Certificate2(dict.GetData("HostCertificate")),
         DeviceCertificate = new X509Certificate2(dict.GetData("DeviceCertificate")),
         HostPrivateKey = DeserializePrivateKey(dict.GetData("HostPrivateKey")),
         RootPrivateKey = DeserializePrivateKey(dict.GetData("RootPrivateKey")),
     });
 }
Пример #3
0
        /// <inheritdoc/>
        public override void FromDictionary(NSDictionary data)
        {
            base.FromDictionary(data);

            this.EscrowBag = data.GetData(nameof(this.EscrowBag));
        }
Пример #4
0
        public void GetData_MissingKey_ReturnsNull()
        {
            var dict = new NSDictionary();

            Assert.Null(dict.GetData("missing"));
        }