public void SourceList() { var sources = new List <AudioSource> { new AudioSource("voice", 1, UserId, AudioFormat.Mono16bitLPCM, 64000, 240, 10, false), new AudioSource("voice", 2, UserId2, AudioFormat.Stereo16bitLPCM, 128000, 480, 10, false) }; var msg = new SourceListMessage(sources); foreach (var s in msg.Sources) { Assert.Contains(s, sources); } msg.WritePayload(serverContext, writer); long length = stream.Position; stream.Position = 0; msg = new SourceListMessage(); msg.ReadPayload(clientContext, reader); Assert.AreEqual(length, stream.Position); foreach (var s in sources) { Assert.Contains(s, msg.Sources.ToList()); } }
public void EmptySourceList() { var msg = new SourceListMessage(new List <AudioSource>()); Assert.AreEqual(0, msg.Sources.Count()); msg.WritePayload(serverContext, writer); long length = stream.Position; stream.Position = 0; msg = new SourceListMessage(); msg.ReadPayload(clientContext, reader); Assert.AreEqual(length, stream.Position); Assert.AreEqual(0, msg.Sources.Count()); }