コード例 #1
0
        public void Error()
        {
            var us = new UnicastSubject <int>().ToSerialized();

            var to = us.Test();

            us.EmitError(new InvalidOperationException(), 1, 2, 3, 4, 5);

            to.AssertFailure(typeof(InvalidOperationException), 1, 2, 3, 4, 5);
        }
コード例 #2
0
        public void Basic()
        {
            var us = new UnicastSubject <int>().ToSerialized();

            var to = us.Test();

            us.EmitAll(1, 2, 3, 4, 5);

            to.AssertResult(1, 2, 3, 4, 5);
        }
コード例 #3
0
        public void OnNext_Race()
        {
            for (int i = 0; i < TestHelper.RACE_LOOPS; i++)
            {
                var us = new UnicastSubject <int>().ToSerialized();

                var to = us.Test();

                Action emit = () => {
                    for (int j = 0; j < 500; j++)
                    {
                        us.OnNext(j);
                    }
                };

                TestHelper.Race(emit, emit);

                to.AssertValueCount(1000);
            }
        }