GetTestSource() public static method

public static GetTestSource ( ) : AudioSource
return AudioSource
Exemplo n.º 1
0
        public void ToggleIgnoreUnknownSource()
        {
            var source = AudioSourceTests.GetTestSource();

            Assert.IsFalse(manager.GetIsIgnored(source));
            Assert.IsFalse(manager.ToggleIgnore(source));
            Assert.IsFalse(manager.GetIsIgnored(source));
        }
Exemplo n.º 2
0
        public void Enumerable()
        {
            var source  = manager.Create("Name", user, AudioSourceTests.GetTestSource().CodecSettings);
            var source2 = manager.Create("Name2", user, AudioSourceTests.GetTestSource().CodecSettings);

            Assert.Contains(source, handler.ToList());
            Assert.Contains(source2, handler.ToList());
        }
Exemplo n.º 3
0
        private IEnumerable <AudioSource> CreateSources()
        {
            var source = AudioSourceTests.GetTestSource(1, 0);

            manager.Add(source);

            var source2 = AudioSourceTests.GetTestSource(2, 1);

            manager.Add(source2);

            return(new[] { source, source2 });
        }
Exemplo n.º 4
0
        public void ToggleIgnore()
        {
            var source = AudioSourceTests.GetTestSource();

            manager.Add(source);

            Assert.IsFalse(handler.GetIsIgnored(source));
            Assert.IsTrue(handler.ToggleIgnore(source));
            Assert.IsTrue(handler.GetIsIgnored(source));
            Assert.IsFalse(handler.ToggleIgnore(source));
            Assert.IsFalse(handler.GetIsIgnored(source));
        }
Exemplo n.º 5
0
        public void Setup()
        {
            this.provider = new MockAudioCaptureProvider();
            this.source   = AudioSourceTests.GetTestSource();

            var c = new MockConnectionProvider(GablarskiProtocol.Instance).GetClientConnection();

            var client = new MockClientContext(c);

            this.context  = client;
            this.sender   = new ClientSourceHandler(client, new ClientSourceManager(client));
            this.receiver = (IAudioReceiver)this.sender;
        }
Exemplo n.º 6
0
        public void Add()
        {
            CreateSources();

            var csource = manager.FirstOrDefault(s => s.Id == 1);

            Assert.IsNotNull(csource, "Source not found");
            AudioSourceTests.AssertSourcesMatch(AudioSourceTests.GetTestSource(1, 0), csource);
            Assert.IsTrue(manager[context.CurrentUser].Contains(csource), "Owned sources did not contain source");

            var source = manager.FirstOrDefault(s => s.Id == 2);

            Assert.IsNotNull(source, "Source not found");
            AudioSourceTests.AssertSourcesMatch(AudioSourceTests.GetTestSource(2, 1), source);
        }
Exemplo n.º 7
0
        public void RequestMuteSource()
        {
            Assert.Throws <ArgumentNullException> (() => new RequestMuteSourceMessage(null, true));

            var source = AudioSourceTests.GetTestSource(2, 4);
            var msg    = new RequestMuteSourceMessage(source, false);

            msg.WritePayload(null, writer);
            long length = stream.Position;

            stream.Position = 0;

            msg = new RequestMuteSourceMessage();
            msg.ReadPayload(null, reader);
            Assert.AreEqual(length, stream.Position);
            Assert.AreEqual(source.Id, msg.TargetId);
            Assert.AreEqual(true, msg.Unmute);
        }
Exemplo n.º 8
0
 public void SendAudioDataInvalid()
 {
     Assert.Throws <ArgumentException> (() => handler.SendAudioDataAsync(AudioSourceTests.GetTestSource(), TargetType.User, new [] { 1 }, new byte[0][]));
     Assert.Throws <ArgumentException> (() => handler.SendAudioDataAsync(AudioSourceTests.GetTestSource(2), TargetType.User, new [] { 1 }, new byte[1][]));
 }
Exemplo n.º 9
0
 public void SendAudioDataNull()
 {
     Assert.Throws <ArgumentNullException> (() => handler.SendAudioDataAsync(null, TargetType.User, new [] { 1 }, new byte[1][]));
     Assert.Throws <ArgumentNullException> (() => handler.SendAudioDataAsync(AudioSourceTests.GetTestSource(), TargetType.User, null, new byte[1][]));
     Assert.Throws <ArgumentNullException> (() => handler.SendAudioDataAsync(AudioSourceTests.GetTestSource(), TargetType.User, new [] { 1 }, null));
 }