StyledPropertyTests.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (c) The Perspex Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using Xunit;
  4. namespace Perspex.Base.UnitTests
  5. {
  6. public class StyledPropertyTests
  7. {
  8. [Fact]
  9. public void AddOwnered_Property_Should_Equal_Original()
  10. {
  11. var p1 = new StyledProperty<string>(
  12. "p1",
  13. typeof(Class1),
  14. new StyledPropertyMetadata<string>());
  15. var p2 = p1.AddOwner<Class2>();
  16. Assert.Equal(p1, p2);
  17. Assert.Equal(p1.GetHashCode(), p2.GetHashCode());
  18. Assert.True(p1 == p2);
  19. }
  20. [Fact]
  21. public void AddOwnered_Property_Should_Be_Same()
  22. {
  23. var p1 = new StyledProperty<string>(
  24. "p1",
  25. typeof(Class1),
  26. new StyledPropertyMetadata<string>());
  27. var p2 = p1.AddOwner<Class2>();
  28. Assert.Same(p1, p2);
  29. }
  30. private class Class1 : PerspexObject
  31. {
  32. }
  33. private class Class2 : PerspexObject
  34. {
  35. }
  36. }
  37. }