RectangleToolTests.cs 999 B

123456789101112131415161718192021222324252627282930
  1. using System.Linq;
  2. using PixiEditor.Models.Position;
  3. using PixiEditor.Models.Tools.Tools;
  4. using Xunit;
  5. namespace PixiEditorTests.ModelsTests.ToolsTests
  6. {
  7. [Collection("Application collection")]
  8. public class RectangleToolTests
  9. {
  10. [StaTheory]
  11. [InlineData(0, 0, 2, 2)]
  12. [InlineData(0, 0, 9, 9)]
  13. [InlineData(5, 5, 6, 6)]
  14. [InlineData(0, 0, 15, 15)]
  15. public void TestThatCreateRectangleCalculatesCorrectOutlineWithOneThickness(int startX, int startY, int endX, int endY)
  16. {
  17. RectangleTool tool = new RectangleTool();
  18. System.Collections.Generic.IEnumerable<Coordinates> outline = tool.CreateRectangle(
  19. new Coordinates(startX, startY),
  20. new Coordinates(endX, endY),
  21. 1);
  22. int expectedBorderPoints = ((endX - startX) * 2) + ((endY - startX) * 2);
  23. Assert.Equal(expectedBorderPoints, outline.Count());
  24. }
  25. }
  26. }