public void WhenAnyShouldRunInContext()
        {
            var tid = Thread.CurrentThread.ManagedThreadId;

            (Scheduler.TaskPool).With(sched => {
                int whenAnyTid = 0;
                var fixture    = new TestFixture()
                {
                    IsNotNullString = "Foo", IsOnlyOneWord = "Baz", PocoProperty = "Bamf"
                };

                fixture.WhenAny(x => x.IsNotNullString, x => x.Value).Subscribe(x => {
                    whenAnyTid = Thread.CurrentThread.ManagedThreadId;
                });

                int timeout             = 10;
                fixture.IsNotNullString = "Bar";
                while (--timeout > 0 && whenAnyTid == 0)
                {
                    Thread.Sleep(250);
                }

                Assert.Equal(tid, whenAnyTid);
            });
        }
        public void WhenAnyShouldWorkEvenWithNormalProperties()
        {
            var fixture = new TestFixture
            {
                IsNotNullString = "Foo",
                IsOnlyOneWord   = "Baz",
                PocoProperty    = "Bamf"
            };

            var output = new List <IObservedChange <TestFixture, string> >();

            fixture.WhenAny(x => x.PocoProperty, x => x).Subscribe(output.Add);
            var output2 = new List <string>();

            fixture.WhenAnyValue(x => x.PocoProperty).Subscribe(output2.Add);
            var output3 = new List <IObservedChange <TestFixture, int?> >();

            fixture.WhenAny(x => x.NullableInt, x => x).Subscribe(output3.Add);

            var output4 = new List <int?>();

            fixture.WhenAnyValue(x => x.NullableInt).Subscribe(output4.Add);

            Assert.Equal(1, output.Count);
            Assert.Equal(fixture, output[0].Sender);
            Assert.Equal("PocoProperty", output[0].GetPropertyName());
            Assert.Equal("Bamf", output[0].Value);

            Assert.Equal(1, output2.Count);
            Assert.Equal("Bamf", output2[0]);

            Assert.Equal(1, output3.Count);
            Assert.Equal(fixture, output3[0].Sender);
            Assert.Equal("NullableInt", output3[0].GetPropertyName());
            Assert.Equal(null, output3[0].Value);

            Assert.Equal(1, output4.Count);
            Assert.Equal(null, output4[0]);
        }
        public void WhenAnyShouldWorkEvenWithNormalProperties()
        {
            var fixture = new TestFixture()
            {
                IsNotNullString = "Foo", IsOnlyOneWord = "Baz", PocoProperty = "Bamf"
            };

            var output = new List <IObservedChange <TestFixture, string> >();

            fixture.WhenAny(x => x.PocoProperty, x => x).Subscribe(output.Add);

            Assert.Equal(1, output.Count);
            Assert.Equal(fixture, output[0].Sender);
            Assert.Equal("PocoProperty", output[0].PropertyName);
            Assert.Equal("Bamf", output[0].Value);
        }
        public void WhenAnyShouldWorkEvenWithNormalProperties()
        {
            var fixture = new TestFixture() { IsNotNullString = "Foo", IsOnlyOneWord = "Baz", PocoProperty = "Bamf" };

            var output = new List<IObservedChange<TestFixture, string>>();
            fixture.WhenAny(x => x.PocoProperty, x => x).Subscribe(output.Add);

            Assert.Equal(1, output.Count);
            Assert.Equal(fixture, output[0].Sender);
            Assert.Equal("PocoProperty", output[0].PropertyName);
            Assert.Equal("Bamf", output[0].Value);
        }