Skip to content

Commit

Permalink
Use primary constructor for test "Point"
Browse files Browse the repository at this point in the history
  • Loading branch information
atifaziz committed Dec 11, 2023
1 parent ab184db commit c4cd051
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions MoreLinq.Test/ToDataTableTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,14 @@ public void ToDataTableWithSchema()
Assert.That(rows.Select(r => r["Value"]).ToArray(), Is.EqualTo(vars.Select(e => e.Value).ToArray()));
}

readonly struct Point
readonly struct Point(int x, int y)
{
#pragma warning disable CA1805 // Do not initialize unnecessarily (avoids CS0649)
public static Point Empty = new();
#pragma warning restore CA1805 // Do not initialize unnecessarily
public bool IsEmpty => X == 0 && Y == 0;
public int X { get; }
public int Y { get; }
public Point(int x, int y) : this() { X = x; Y = y; }
public int X { get; } = x;
public int Y { get; } = y;
}

[Test]
Expand Down

0 comments on commit c4cd051

Please sign in to comment.