ReadonlyUtilityTests.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Security.Cryptography.X509Certificates;
  4. using System.Text;
  5. using PixiEditor.Models.Controllers;
  6. using PixiEditor.Models.Position;
  7. using PixiEditor.Models.Tools;
  8. using Xunit;
  9. namespace PixiEditorTests.ModelsTests.ControllersTests
  10. {
  11. public class ReadonlyUtilityTests
  12. {
  13. [Fact]
  14. public void TestThatExecuteToolExecutesTool()
  15. {
  16. bool toolUsed = false;
  17. ReadonlyToolUtility util = new ReadonlyToolUtility();
  18. util.ExecuteTool(new[]{new Coordinates(0,0)}, new TestReadonlyTool(() => toolUsed = true));
  19. Assert.True(toolUsed);
  20. }
  21. }
  22. public class TestReadonlyTool : ReadonlyTool
  23. {
  24. public Action ToolAction { get; set; }
  25. public TestReadonlyTool(Action toolAction)
  26. {
  27. ToolAction = toolAction;
  28. }
  29. public override ToolType ToolType => ToolType.Select;
  30. public override void Use(Coordinates[] pixels)
  31. {
  32. ToolAction();
  33. }
  34. }
  35. }