Change to behavior matching System.Drawing.Rectangle

This commit is contained in:
Brandon Thetford
2024-02-20 17:45:04 -07:00
parent e38933d3d6
commit 53df3eac2a
2 changed files with 2 additions and 2 deletions

View File

@@ -287,5 +287,5 @@ public struct Rectangle
/// <summary>ToString Method</summary>
/// <remarks>Formats the Rectangle as a string in (x,y,w,h) notation.</remarks>
public override string ToString () { return $"({X},{Y},{Width},{Height})"; }
public override string ToString () { return $"{{X={X},Y={Y},Width={Width},Height={Height}}}"; }
}

View File

@@ -513,7 +513,7 @@ public class RectangleTests
public void ToString_ReturnsExpectedString ([CombinatorialValues(-1,0,1)]int x, [CombinatorialValues(-1,0,1)]int y, [CombinatorialValues(1,10)]int width, [CombinatorialValues(1,10)]int height)
{
Rectangle r = new (x, y, width, height);
string expectedString = $"({r.X},{r.Y},{r.Width},{r.Height})";
string expectedString = $"{{X={r.X},Y={r.Y},Width={r.Width},Height={r.Height}}}";
Assert.Equal (expectedString, r.ToString ());
}
}