Browse Source

Added some more direct PP tests.

pull/223/head
Steven Kirk 11 years ago
parent
commit
45b8547fcf
  1. 34
      tests/Perspex.Base.UnitTests/PerspexObjectTests_Direct.cs

34
tests/Perspex.Base.UnitTests/PerspexObjectTests_Direct.cs

@ -63,6 +63,23 @@ namespace Perspex.Base.UnitTests
Assert.True(raised);
}
[Fact]
public void SetValue_Raises_Changed()
{
var target = new Class1();
bool raised = false;
Class1.FooProperty.Changed.Subscribe(e =>
raised = e.Property == Class1.FooProperty &&
(string)e.OldValue == "initial" &&
(string)e.NewValue == "newvalue" &&
e.Priority == BindingPriority.LocalValue);
target.SetValue(Class1.FooProperty, "newvalue");
Assert.True(raised);
}
[Fact]
public void GetObservable_Returns_Values()
{
@ -237,6 +254,23 @@ namespace Perspex.Base.UnitTests
Assert.Equal("second", target.Foo);
}
[Fact]
public void Property_Notifies_Initialized()
{
Class1 target;
bool raised = false;
Class1.FooProperty.Initialized.Subscribe(e =>
raised = e.Property == Class1.FooProperty &&
e.OldValue == PerspexProperty.UnsetValue &&
(string)e.NewValue == "initial" &&
e.Priority == BindingPriority.Unset);
target = new Class1();
Assert.True(raised);
}
private class Class1 : PerspexObject
{
public static readonly PerspexProperty<string> FooProperty =

Loading…
Cancel
Save