forked from reactiveui/ReactiveUI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakeObjectReactiveHelperTest.cs
63 lines (54 loc) · 1.89 KB
/
MakeObjectReactiveHelperTest.cs
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using Xunit;
namespace ReactiveUI.Tests
{
public class NonReactiveINPCObjectMadeReactive : IReactiveNotifyPropertyChanged
{
public event PropertyChangingEventHandler PropertyChanging;
public event PropertyChangedEventHandler PropertyChanged;
TestFixture _InpcProperty;
public TestFixture InpcProperty {
get { return _InpcProperty; }
set {
if (_InpcProperty == value) {
return;
}
_InpcProperty = value;
PropertyChanged(this, new PropertyChangedEventArgs("InpcProperty"));
}
}
MakeObjectReactiveHelper _reactiveHelper;
public NonReactiveINPCObjectMadeReactive()
{
_reactiveHelper = new MakeObjectReactiveHelper(this);
}
public IObservable<IObservedChange<object, object>> Changing {
get { return _reactiveHelper.Changing; }
}
public IObservable<IObservedChange<object, object>> Changed {
get { return _reactiveHelper.Changed; }
}
public IDisposable SuppressChangeNotifications() {
return _reactiveHelper.SuppressChangeNotifications();
}
}
public class MakeObjectReactiveHelperTest
{
[Fact]
public void MakeObjectReactiveHelperSmokeTest()
{
var fixture = new NonReactiveINPCObjectMadeReactive();
var output = fixture.Changed.CreateCollection();
Assert.Equal(0, output.Count);
var input = new TestFixture();
fixture.InpcProperty = input;
Assert.Equal(1, output.Count);
Assert.Equal(fixture, output[0].Sender);
Assert.Equal("InpcProperty", output[0].PropertyName);
}
}
}