Skip to content
This repository
tree: 1c6ed1bd4b
Fetching contributors…

Cannot retrieve contributors at this time

file 49 lines (43 sloc) 1.55 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
using ReactiveXaml;
using Xunit;
using System;
using System.Linq;
using System.Concurrency;
using System.Collections.Generic;
using System.Threading;
using System.Windows;
using ReactiveXaml.Testing;

namespace ReactiveXaml.Tests
{
    public class DepObjFixture : FrameworkElement
    {
        public static readonly DependencyProperty TestStringProperty =
            DependencyProperty.Register("TestString", typeof(string), typeof(DepObjFixture), new PropertyMetadata(null));

        public string TestString {
            get { return (string)GetValue(TestStringProperty); }
            set { SetValue(TestStringProperty, value); }
        }
    }

    public class DependencyObjectMixinTest : IEnableLogger
    {
[Fact]
        public void ObservableFromDPSmokeTest()
        {
            (new TestScheduler()).With(sched => {
                var input = new[] {"Foo", "Bar", "Baz"};
                var fixture = new DepObjFixture();
                var output = fixture.ObservableFromDP(x => x.TestString).CreateCollection();

                foreach (var v in input) {
                    fixture.TestString = v;
                }

                sched.Run();
                input.AssertAreEqual(output.Select(x => x.Value));
                foreach (var v in output) {
                    Assert.Equal(fixture, v.Sender);
                    Assert.Equal("TestString", v.PropertyName);
                }

                return new Unit();
            });
        }
    }
}
Something went wrong with that request. Please try again.