From 0004da89255b16ce7e6a0b8aa4c7223b49ec26bf Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Wed, 30 May 2018 21:35:48 +0100 Subject: [PATCH] update dependencies and fix xunit warnings --- NuGet.config | 2 +- SixLabors.Shapes.sln | 6 ++- .../DrawShapesWithImageSharp.csproj | 4 +- .../SixLabors.Shapes.Text.csproj | 2 +- src/SixLabors.Shapes/SixLabors.Shapes.csproj | 4 +- .../SixLabors.Shapes.Benchmarks.csproj | 2 +- .../InternalPathTests.cs | 8 ++-- .../SixLabors.Shapes.Tests/Issues/Issue_16.cs | 2 +- .../PathExtentionTests.cs | 40 +++++++++---------- .../PolygonClipper/ClipperTests.cs | 12 +++--- tests/SixLabors.Shapes.Tests/PolygonTests.cs | 4 +- .../SixLabors.Shapes.Tests/RectangleTests.cs | 4 +- .../SixLabors.Shapes.Tests.csproj | 10 ++--- .../Structs/TestPoint.cs | 6 +-- .../Structs/TestSize.cs | 6 +-- 15 files changed, 58 insertions(+), 54 deletions(-) diff --git a/NuGet.config b/NuGet.config index 13d473e..5ae2e23 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,7 +1,7 @@  - + diff --git a/SixLabors.Shapes.sln b/SixLabors.Shapes.sln index 1fbef7e..cd68ce0 100644 --- a/SixLabors.Shapes.sln +++ b/SixLabors.Shapes.sln @@ -8,6 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionIt .editorconfig = .editorconfig appveyor.yml = appveyor.yml build.cmd = build.cmd + NuGet.config = NuGet.config README.md = README.md EndProjectSection EndProject @@ -29,7 +30,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SixLabors.Shapes.Tests", "t EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DrawShapesWithImageSharp", "samples\DrawShapesWithImageSharp\DrawShapesWithImageSharp.csproj", "{999EDFB3-9FE4-4E09-B669-CB02E597EC20}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SixLabors.Shapes.Benchmarks", "tests\SixLabors.Shapes.Benchmarks\SixLabors.Shapes.Benchmarks.csproj", "{87E262FA-57FE-4AA7-853C-9DD91E769D4B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SixLabors.Shapes.Benchmarks", "tests\SixLabors.Shapes.Benchmarks\SixLabors.Shapes.Benchmarks.csproj", "{87E262FA-57FE-4AA7-853C-9DD91E769D4B}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SixLabors.Shapes.Text", "src\SixLabors.Shapes.Text\SixLabors.Shapes.Text.csproj", "{32D7A12E-B392-42CE-8EFB-1B685680F5B8}" EndProject @@ -71,6 +72,9 @@ Global {87E262FA-57FE-4AA7-853C-9DD91E769D4B} = {56801022-D71A-4FBE-BC5B-CBA08E2284EC} {32D7A12E-B392-42CE-8EFB-1B685680F5B8} = {815C0625-CD3D-440F-9F80-2D83856AB7AE} EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A0074D4F-97D9-49A4-BE1F-35AFCEA40486} + EndGlobalSection GlobalSection(Performance) = preSolution HasPerformanceSessions = true EndGlobalSection diff --git a/samples/DrawShapesWithImageSharp/DrawShapesWithImageSharp.csproj b/samples/DrawShapesWithImageSharp/DrawShapesWithImageSharp.csproj index e976bc7..e2ad38a 100644 --- a/samples/DrawShapesWithImageSharp/DrawShapesWithImageSharp.csproj +++ b/samples/DrawShapesWithImageSharp/DrawShapesWithImageSharp.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/src/SixLabors.Shapes.Text/SixLabors.Shapes.Text.csproj b/src/SixLabors.Shapes.Text/SixLabors.Shapes.Text.csproj index d08eb54..cce542a 100644 --- a/src/SixLabors.Shapes.Text/SixLabors.Shapes.Text.csproj +++ b/src/SixLabors.Shapes.Text/SixLabors.Shapes.Text.csproj @@ -41,7 +41,7 @@ All - + diff --git a/src/SixLabors.Shapes/SixLabors.Shapes.csproj b/src/SixLabors.Shapes/SixLabors.Shapes.csproj index cffe5e6..a613bbf 100644 --- a/src/SixLabors.Shapes/SixLabors.Shapes.csproj +++ b/src/SixLabors.Shapes/SixLabors.Shapes.csproj @@ -48,7 +48,7 @@ All - - + + \ No newline at end of file diff --git a/tests/SixLabors.Shapes.Benchmarks/SixLabors.Shapes.Benchmarks.csproj b/tests/SixLabors.Shapes.Benchmarks/SixLabors.Shapes.Benchmarks.csproj index df7d068..1eaf5fb 100644 --- a/tests/SixLabors.Shapes.Benchmarks/SixLabors.Shapes.Benchmarks.csproj +++ b/tests/SixLabors.Shapes.Benchmarks/SixLabors.Shapes.Benchmarks.csproj @@ -6,7 +6,7 @@ - + diff --git a/tests/SixLabors.Shapes.Tests/InternalPathTests.cs b/tests/SixLabors.Shapes.Tests/InternalPathTests.cs index 9219b81..c54177b 100644 --- a/tests/SixLabors.Shapes.Tests/InternalPathTests.cs +++ b/tests/SixLabors.Shapes.Tests/InternalPathTests.cs @@ -215,7 +215,7 @@ namespace SixLabors.Shapes.Tests PointF[] buffer = shape.FindIntersections(new PointF(0, 10), new PointF(10, 0)).ToArray(); - Assert.Equal(1, buffer.Length); + Assert.Single(buffer); Assert.Equal(new PointF(5, 5), buffer[0]); } @@ -226,7 +226,7 @@ namespace SixLabors.Shapes.Tests PointF[] buffer = shape.FindIntersections(new PointF(0, 10), new PointF(10, 0)).ToArray(); - Assert.Equal(0, buffer.Length); + Assert.Empty(buffer); } [Fact] public void Intersections_Diagonal_and_straight_Hit() @@ -235,7 +235,7 @@ namespace SixLabors.Shapes.Tests PointF[] buffer = shape.FindIntersections(new PointF(3, 10), new PointF(3, 0)).ToArray(); - Assert.Equal(1, buffer.Length); + Assert.Single(buffer); Assert.Equal(new PointF(3, 3), buffer[0]); } [Fact] @@ -245,7 +245,7 @@ namespace SixLabors.Shapes.Tests PointF[] buffer = shape.FindIntersections(new PointF(3, 10), new PointF(3, 3.5f)).ToArray(); - Assert.Equal(0, buffer.Length); + Assert.Empty(buffer); } } } diff --git a/tests/SixLabors.Shapes.Tests/Issues/Issue_16.cs b/tests/SixLabors.Shapes.Tests/Issues/Issue_16.cs index cbd5f57..8c529a6 100644 --- a/tests/SixLabors.Shapes.Tests/Issues/Issue_16.cs +++ b/tests/SixLabors.Shapes.Tests/Issues/Issue_16.cs @@ -22,7 +22,7 @@ namespace SixLabors.Shapes.Tests IEnumerable inter = p.FindIntersections(Vector2.One, Vector2.Zero); // if simplified to single point then we should never have an intersection - Assert.Equal(0, inter.Count()); + Assert.Empty(inter); } } } diff --git a/tests/SixLabors.Shapes.Tests/PathExtentionTests.cs b/tests/SixLabors.Shapes.Tests/PathExtentionTests.cs index 8363f60..a3097e5 100644 --- a/tests/SixLabors.Shapes.Tests/PathExtentionTests.cs +++ b/tests/SixLabors.Shapes.Tests/PathExtentionTests.cs @@ -17,8 +17,8 @@ namespace SixLabors.Shapes.Tests public PathExtentionTests() { this.bounds = new RectangleF(10, 10, 20, 20); - mockPath = new Mock(); - mockPath.Setup(x => x.Bounds).Returns(() => bounds); + this.mockPath = new Mock(); + this.mockPath.Setup(x => x.Bounds).Returns(() => this.bounds); } [Fact] @@ -26,20 +26,20 @@ namespace SixLabors.Shapes.Tests { float angle = (float)Math.PI; - mockPath.Setup(x => x.Transform(It.IsAny())) + this.mockPath.Setup(x => x.Transform(It.IsAny())) .Callback(m => { //validate matrix in here - Matrix3x2 targetMatrix = Matrix3x2.CreateRotation(angle, RectangleF.Center(bounds)); + Matrix3x2 targetMatrix = Matrix3x2.CreateRotation(angle, RectangleF.Center(this.bounds)); Assert.Equal(targetMatrix, m); - }).Returns(mockPath.Object); + }).Returns(this.mockPath.Object); - mockPath.Object.Rotate(angle); + this.mockPath.Object.Rotate(angle); - mockPath.Verify(x => x.Transform(It.IsAny()), Times.Once); + this.mockPath.Verify(x => x.Transform(It.IsAny()), Times.Once); } [Fact] @@ -47,21 +47,21 @@ namespace SixLabors.Shapes.Tests { float angle = 90; - mockPath.Setup(x => x.Transform(It.IsAny())) + this.mockPath.Setup(x => x.Transform(It.IsAny())) .Callback(m => { //validate matrix in here float radians = (float)(Math.PI * angle / 180.0); - Matrix3x2 targetMatrix = Matrix3x2.CreateRotation(radians, RectangleF.Center(bounds)); + Matrix3x2 targetMatrix = Matrix3x2.CreateRotation(radians, RectangleF.Center(this.bounds)); Assert.Equal(targetMatrix, m); - }).Returns(mockPath.Object); + }).Returns(this.mockPath.Object); - mockPath.Object.RotateDegree(angle); + this.mockPath.Object.RotateDegree(angle); - mockPath.Verify(x => x.Transform(It.IsAny()), Times.Once); + this.mockPath.Verify(x => x.Transform(It.IsAny()), Times.Once); } [Fact] @@ -69,7 +69,7 @@ namespace SixLabors.Shapes.Tests { Vector2 point = new Vector2(98, 120); - mockPath.Setup(x => x.Transform(It.IsAny())) + this.mockPath.Setup(x => x.Transform(It.IsAny())) .Callback(m => { //validate matrix in here @@ -78,11 +78,11 @@ namespace SixLabors.Shapes.Tests Assert.Equal(targetMatrix, m); - }).Returns(mockPath.Object); + }).Returns(this.mockPath.Object); - mockPath.Object.Translate(point); + this.mockPath.Object.Translate(point); - mockPath.Verify(x => x.Transform(It.IsAny()), Times.Once); + this.mockPath.Verify(x => x.Transform(It.IsAny()), Times.Once); } [Fact] @@ -91,7 +91,7 @@ namespace SixLabors.Shapes.Tests float x = 76; float y = 7; - mockPath.Setup(p => p.Transform(It.IsAny())) + this.mockPath.Setup(p => p.Transform(It.IsAny())) .Callback(m => { //validate matrix in here @@ -100,11 +100,11 @@ namespace SixLabors.Shapes.Tests Assert.Equal(targetMatrix, m); - }).Returns(mockPath.Object); + }).Returns(this.mockPath.Object); - mockPath.Object.Translate(x, y); + this.mockPath.Object.Translate(x, y); - mockPath.Verify(p => p.Transform(It.IsAny()), Times.Once); + this.mockPath.Verify(p => p.Transform(It.IsAny()), Times.Once); } } } diff --git a/tests/SixLabors.Shapes.Tests/PolygonClipper/ClipperTests.cs b/tests/SixLabors.Shapes.Tests/PolygonClipper/ClipperTests.cs index 8e96c4c..a61e3d5 100644 --- a/tests/SixLabors.Shapes.Tests/PolygonClipper/ClipperTests.cs +++ b/tests/SixLabors.Shapes.Tests/PolygonClipper/ClipperTests.cs @@ -65,7 +65,7 @@ namespace SixLabors.Shapes.Tests.PolygonClipper new Vector2(20, 100))); IEnumerable shapes = this.Clip(triangle, cutout); - Assert.Equal(1, shapes.Count()); + Assert.Single(shapes); Assert.DoesNotContain(triangle, shapes); } @@ -73,7 +73,7 @@ namespace SixLabors.Shapes.Tests.PolygonClipper public void OverlappingTriangles() { IEnumerable shapes = this.Clip(this.BigTriangle, this.LittleTriangle); - Assert.Equal(1, shapes.Count()); + Assert.Single(shapes); IReadOnlyList path = shapes.Single().Flatten().First().Points; Assert.Equal(7, path.Count); foreach (Vector2 p in this.BigTriangle.Flatten().First().Points) @@ -88,7 +88,7 @@ namespace SixLabors.Shapes.Tests.PolygonClipper IEnumerable shapes = this.Clip(this.TopLeft, this.TopRight) .OfType().Select(x => (RectangularPolygon)x); - Assert.Equal(1, shapes.Count()); + Assert.Single(shapes); Assert.Contains(this.TopLeft, shapes); Assert.DoesNotContain(this.TopRight, shapes); @@ -99,7 +99,7 @@ namespace SixLabors.Shapes.Tests.PolygonClipper { IEnumerable shapes = this.Clip(this.BigSquare, this.TopLeft); - Assert.Equal(1, shapes.Count()); + Assert.Single(shapes); Assert.DoesNotContain(this.BigSquare, shapes); Assert.DoesNotContain(this.TopLeft, shapes); } @@ -119,7 +119,7 @@ namespace SixLabors.Shapes.Tests.PolygonClipper public void TouchingButNotOverlapping() { IEnumerable shapes = this.Clip(this.TopMiddle, this.TopLeft); - Assert.Equal(1, shapes.Count()); + Assert.Single(shapes); Assert.DoesNotContain(this.TopMiddle, shapes); Assert.DoesNotContain(this.TopLeft, shapes); } @@ -128,7 +128,7 @@ namespace SixLabors.Shapes.Tests.PolygonClipper public void ClippingRectanglesCreateCorrectNumberOfPoints() { IEnumerable paths = new RectangularPolygon(10, 10, 40, 40).Clip(new RectangularPolygon(20, 0, 20, 20)).Flatten(); - Assert.Equal(1, paths.Count()); + Assert.Single(paths); IReadOnlyList points = paths.First().Points; Assert.Equal(8, points.Count); diff --git a/tests/SixLabors.Shapes.Tests/PolygonTests.cs b/tests/SixLabors.Shapes.Tests/PolygonTests.cs index 7a51c3b..1e8f2b3 100644 --- a/tests/SixLabors.Shapes.Tests/PolygonTests.cs +++ b/tests/SixLabors.Shapes.Tests/PolygonTests.cs @@ -148,7 +148,7 @@ namespace SixLabors.Shapes.Tests { Polygon poly = new Polygon(new LinearLineSegment(new PointF(0, 0), new PointF(0, 10), new PointF(5, 5))); ISimplePath[] paths = poly.Flatten().ToArray(); - Assert.Equal(1, paths.Length); + Assert.Single(paths); Assert.Equal(poly, paths[0]); } @@ -157,7 +157,7 @@ namespace SixLabors.Shapes.Tests { Polygon poly = new Polygon(new LinearLineSegment(new PointF(0, 0), new PointF(0, 10)), new LinearLineSegment(new PointF(2, 5), new PointF(5, 5))); ISimplePath[] paths = poly.Flatten().ToArray(); - Assert.Equal(1, paths.Length); + Assert.Single(paths); Assert.Equal(poly, paths[0]); } diff --git a/tests/SixLabors.Shapes.Tests/RectangleTests.cs b/tests/SixLabors.Shapes.Tests/RectangleTests.cs index aa0786f..9750366 100644 --- a/tests/SixLabors.Shapes.Tests/RectangleTests.cs +++ b/tests/SixLabors.Shapes.Tests/RectangleTests.cs @@ -201,7 +201,7 @@ namespace SixLabors.Shapes.Tests IPath shape = new RectangularPolygon(1, 1, 10, 10); IEnumerable intersections = shape.FindIntersections(new PointF(0, 5), new PointF(5, 5)); - Assert.Equal(1, intersections.Count()); + Assert.Single(intersections); Assert.Equal(new PointF(1, 5), intersections.First()); } @@ -211,7 +211,7 @@ namespace SixLabors.Shapes.Tests IPath shape = new RectangularPolygon(1, 1, 10, 10); IEnumerable intersections = shape.FindIntersections(new PointF(0, 5), new PointF(-5, 5)); - Assert.Equal(0, intersections.Count()); + Assert.Empty(intersections); } [Fact] diff --git a/tests/SixLabors.Shapes.Tests/SixLabors.Shapes.Tests.csproj b/tests/SixLabors.Shapes.Tests/SixLabors.Shapes.Tests.csproj index 97e8c8a..94893c2 100644 --- a/tests/SixLabors.Shapes.Tests/SixLabors.Shapes.Tests.csproj +++ b/tests/SixLabors.Shapes.Tests/SixLabors.Shapes.Tests.csproj @@ -21,11 +21,11 @@ - - - - - + + + + + diff --git a/tests/SixLabors.Shapes.Tests/Structs/TestPoint.cs b/tests/SixLabors.Shapes.Tests/Structs/TestPoint.cs index dab993d..0f57460 100644 --- a/tests/SixLabors.Shapes.Tests/Structs/TestPoint.cs +++ b/tests/SixLabors.Shapes.Tests/Structs/TestPoint.cs @@ -31,13 +31,13 @@ namespace SixLabors.Shapes.Tests public void Serialize(IXunitSerializationInfo info) { - info.AddValue("X", X); - info.AddValue("Y", Y); + info.AddValue("X", this.X); + info.AddValue("Y", this.Y); } public override string ToString() { - return $"({X}, {Y})"; + return $"({this.X}, {this.Y})"; } public static implicit operator PointF(TestPoint p) diff --git a/tests/SixLabors.Shapes.Tests/Structs/TestSize.cs b/tests/SixLabors.Shapes.Tests/Structs/TestSize.cs index 92258d4..25751b3 100644 --- a/tests/SixLabors.Shapes.Tests/Structs/TestSize.cs +++ b/tests/SixLabors.Shapes.Tests/Structs/TestSize.cs @@ -29,8 +29,8 @@ namespace SixLabors.Shapes.Tests public void Serialize(IXunitSerializationInfo info) { - info.AddValue("width", Width); - info.AddValue("height", Height); + info.AddValue("width", this.Width); + info.AddValue("height", this.Height); } public static implicit operator SizeF(TestSize p) @@ -43,7 +43,7 @@ namespace SixLabors.Shapes.Tests } public override string ToString() { - return $"{Width}x{Height}"; + return $"{this.Width}x{this.Height}"; } } }