StyledPropertyTests.cs 999 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using Xunit;
  2. namespace Avalonia.Base.UnitTests
  3. {
  4. public class StyledPropertyTests
  5. {
  6. [Fact]
  7. public void AddOwnered_Property_Should_Equal_Original()
  8. {
  9. var p1 = new StyledProperty<string>(
  10. "p1",
  11. typeof(Class1),
  12. new StyledPropertyMetadata<string>());
  13. var p2 = p1.AddOwner<Class2>();
  14. Assert.Equal(p1, p2);
  15. Assert.Equal(p1.GetHashCode(), p2.GetHashCode());
  16. Assert.True(p1 == p2);
  17. }
  18. [Fact]
  19. public void AddOwnered_Property_Should_Be_Same()
  20. {
  21. var p1 = new StyledProperty<string>(
  22. "p1",
  23. typeof(Class1),
  24. new StyledPropertyMetadata<string>());
  25. var p2 = p1.AddOwner<Class2>();
  26. Assert.Same(p1, p2);
  27. }
  28. private class Class1 : AvaloniaObject
  29. {
  30. }
  31. private class Class2 : AvaloniaObject
  32. {
  33. }
  34. }
  35. }