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); }
/// <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")), }); }
/// <inheritdoc/> public override void FromDictionary(NSDictionary data) { base.FromDictionary(data); this.EscrowBag = data.GetData(nameof(this.EscrowBag)); }
public void GetData_MissingKey_ReturnsNull() { var dict = new NSDictionary(); Assert.Null(dict.GetData("missing")); }