public void ReadAny_ThrowsOnUnknownType() { var dictionary = new NSDictionary(); dictionary.Add(nameof(MuxerMessage.MessageType), nameof(MuxerMessageType.None)); Assert.Throws <ArgumentOutOfRangeException>(() => MuxerMessage.ReadAny(dictionary)); }
public void ReadAny_InvalidMessageType_ThrowsException() { var dict = new NSDictionary(); dict.Add("MessageType", new NSString(nameof(MuxerMessageType.None))); Assert.Throws <ArgumentOutOfRangeException>("data", () => MuxerMessage.ReadAny(new NSDictionary())); }
public void ReadAny_ReadMessage() { Assert.IsType <DeviceAttachedMessage>(MuxerMessage.ReadAny((NSDictionary)PropertyListParser.Parse("Muxer/attached.xml"))); Assert.IsType <DeviceDetachedMessage>(MuxerMessage.ReadAny((NSDictionary)PropertyListParser.Parse("Muxer/detached.xml"))); Assert.IsType <DevicePairedMessage>(MuxerMessage.ReadAny((NSDictionary)PropertyListParser.Parse("Muxer/paired.xml"))); Assert.IsType <ResultMessage>(MuxerMessage.ReadAny((NSDictionary)PropertyListParser.Parse("Muxer/result.xml"))); Assert.IsType <DeviceListMessage>(MuxerMessage.ReadAny((NSDictionary)PropertyListParser.Parse("Muxer/devicelist.xml"))); Assert.IsType <BuidMessage>(MuxerMessage.ReadAny((NSDictionary)PropertyListParser.Parse("Muxer/buid.xml"))); NSDictionary pairingData = new NSDictionary(); pairingData.Add("PairRecordData", new byte[] { }); Assert.IsType <PairingRecordDataMessage>(MuxerMessage.ReadAny(pairingData)); }
public void ReadAny_EmptyDictionary_ThrowsException() { Assert.Throws <ArgumentOutOfRangeException>("data", () => MuxerMessage.ReadAny(new NSDictionary())); }
public void ReadAny_NullArgument_ThrowsException() { Assert.Throws <ArgumentNullException>("data", () => MuxerMessage.ReadAny(null)); }