示例#1
0
        public void TestAttachDetach_WithMessages()
        {
            var results  = new List <MessageArgsBase>();
            var observer = Observer.Create <MessageArgsBase>(x => results.Add(x));

            using var unused1 = _updater.ObserveIncomingCount.Subscribe(observer);
            var message1 = new CountArgs(CountType.ConfigChoice, 10, 0);

            using var unused2 = _updater.ObserveMarker.Subscribe(observer);
            var message2 = new MarkerChangeArgs(0, MarkerType.Cue, 2001);

            using var unused3 = _updater.ObservePlayerState.Subscribe(observer);
            var message3 = new PlaybackStateChangeArgs(20, PlaybackState.Stopped);

            Messages?.Invoke(this, message1);
            _updater.Attach(_messageObservable);
            Messages?.Invoke(this, message2);
            _updater.DetachAll();
            Messages?.Invoke(this, message3);

            Assert.Collection(results, m =>
            {
                var m2 = Assert.IsType <MarkerChangeArgs>(m);
                Assert.Equal(0, m2.ChannelId);
                Assert.Equal(MarkerType.Cue, m2.Marker);
                Assert.Equal(2001u, m2.NewValue);
            });
        }
示例#2
0
 public void TestToString(CountArgs count, string expected)
 {
     Assert.Equal(expected, count.ToString());
 }