Browse Source

Move some tests.

Tests for `AvaloniaObject.IsSet`  were in the `Metadata` test class, though `IsSet` has nothing to do with metadata. Moved them into `SetValue` which is more relevant.
pull/4469/head
Steven Kirk 6 years ago
parent
commit
09b042683a
  1. 29
      tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Metadata.cs
  2. 29
      tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_SetValue.cs

29
tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_Metadata.cs

@ -15,35 +15,6 @@ namespace Avalonia.Base.UnitTests
p = AttachedOwner.AttachedProperty;
}
[Fact]
public void IsSet_Returns_False_For_Unset_Property()
{
var target = new Class1();
Assert.False(target.IsSet(Class1.FooProperty));
}
[Fact]
public void IsSet_Returns_False_For_Set_Property()
{
var target = new Class1();
target.SetValue(Class1.FooProperty, "foo");
Assert.True(target.IsSet(Class1.FooProperty));
}
[Fact]
public void IsSet_Returns_False_For_Cleared_Property()
{
var target = new Class1();
target.SetValue(Class1.FooProperty, "foo");
target.SetValue(Class1.FooProperty, AvaloniaProperty.UnsetValue);
Assert.False(target.IsSet(Class1.FooProperty));
}
private class Class1 : AvaloniaObject
{
public static readonly StyledProperty<string> FooProperty =

29
tests/Avalonia.Base.UnitTests/AvaloniaObjectTests_SetValue.cs

@ -39,6 +39,35 @@ namespace Avalonia.Base.UnitTests
Assert.Equal(1, raised);
}
[Fact]
public void IsSet_Returns_False_For_Unset_Property()
{
var target = new Class1();
Assert.False(target.IsSet(Class1.FooProperty));
}
[Fact]
public void IsSet_Returns_False_For_Set_Property()
{
var target = new Class1();
target.SetValue(Class1.FooProperty, "foo");
Assert.True(target.IsSet(Class1.FooProperty));
}
[Fact]
public void IsSet_Returns_False_For_Cleared_Property()
{
var target = new Class1();
target.SetValue(Class1.FooProperty, "foo");
target.SetValue(Class1.FooProperty, AvaloniaProperty.UnsetValue);
Assert.False(target.IsSet(Class1.FooProperty));
}
[Fact]
public void SetValue_Sets_Value()
{

Loading…
Cancel
Save