TextPresenter_Tests.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using Avalonia.Controls.Presenters;
  2. using Avalonia.UnitTests;
  3. using Xunit;
  4. namespace Avalonia.Controls.UnitTests.Presenters
  5. {
  6. public class TextPresenter_Tests
  7. {
  8. [Fact]
  9. public void TextPresenter_Can_Contain_Null_With_Password_Char_Set()
  10. {
  11. using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface))
  12. {
  13. var target = new TextPresenter
  14. {
  15. PasswordChar = '*'
  16. };
  17. Assert.NotNull(target.FormattedText);
  18. }
  19. }
  20. [Fact]
  21. public void TextPresenter_Can_Contain_Null_WithOut_Password_Char_Set()
  22. {
  23. using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface))
  24. {
  25. var target = new TextPresenter();
  26. Assert.NotNull(target.FormattedText);
  27. }
  28. }
  29. [Fact]
  30. public void Text_Presenter_Replaces_Formatted_Text_With_Password_Char()
  31. {
  32. using (UnitTestApplication.Start(TestServices.MockPlatformRenderInterface))
  33. {
  34. var target = new TextPresenter { PasswordChar = '*', Text = "Test" };
  35. Assert.NotNull(target.FormattedText);
  36. Assert.Equal("****", target.FormattedText.Text);
  37. }
  38. }
  39. }
  40. }