diff --git a/tests/SixLabors.Core.Tests/Primitives/PointFTests.cs b/tests/SixLabors.Core.Tests/Primitives/PointFTests.cs
index b6294cb1a5..5a29d1cff6 100644
--- a/tests/SixLabors.Core.Tests/Primitives/PointFTests.cs
+++ b/tests/SixLabors.Core.Tests/Primitives/PointFTests.cs
@@ -1,22 +1,20 @@
-//
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-//
+
+using System;
+using System.Globalization;
+using System.Numerics;
+using System.Reflection;
+using Xunit;
namespace SixLabors.Primitives.Tests
{
- using System;
- using System.Globalization;
- using System.Numerics;
- using System.Reflection;
- using Xunit;
-
public class PointFTests
{
[Fact]
public void DefaultConstructorTest()
{
- Assert.Equal(PointF.Empty, new PointF());
+ Assert.Equal(PointF.Empty, default(PointF));
}
[Theory]
@@ -37,7 +35,7 @@ namespace SixLabors.Primitives.Tests
public void IsEmptyDefaultsTest()
{
Assert.True(PointF.Empty.IsEmpty);
- Assert.True(new PointF().IsEmpty);
+ Assert.True(default(PointF).IsEmpty);
Assert.True(new PointF(0, 0).IsEmpty);
}
@@ -151,7 +149,7 @@ namespace SixLabors.Primitives.Tests
}
[Fact]
- public static void EqualityTest_NotPointF()
+ public void EqualityTest_NotPointF()
{
var point = new PointF(0, 0);
Assert.False(point.Equals(null));
@@ -167,7 +165,7 @@ namespace SixLabors.Primitives.Tests
}
[Fact]
- public static void GetHashCodeTest()
+ public void GetHashCodeTest()
{
var point = new PointF(10, 10);
Assert.Equal(point.GetHashCode(), new PointF(10, 10).GetHashCode());
diff --git a/tests/SixLabors.Core.Tests/Primitives/PointTests.cs b/tests/SixLabors.Core.Tests/Primitives/PointTests.cs
index 3f17aebfcb..a1880d0e1e 100644
--- a/tests/SixLabors.Core.Tests/Primitives/PointTests.cs
+++ b/tests/SixLabors.Core.Tests/Primitives/PointTests.cs
@@ -1,21 +1,18 @@
-//
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-//
+
+using System.Globalization;
+using System.Numerics;
+using Xunit;
namespace SixLabors.Primitives.Tests
{
- using System.Globalization;
- using System.Numerics;
-
- using Xunit;
-
public class PointTests
{
[Fact]
public void DefaultConstructorTest()
{
- Assert.Equal(Point.Empty, new Point());
+ Assert.Equal(Point.Empty, default(Point));
}
[Theory]
@@ -47,7 +44,7 @@ namespace SixLabors.Primitives.Tests
public void IsEmptyDefaultsTest()
{
Assert.True(Point.Empty.IsEmpty);
- Assert.True(new Point().IsEmpty);
+ Assert.True(default(Point).IsEmpty);
Assert.True(new Point(0, 0).IsEmpty);
}
@@ -186,7 +183,7 @@ namespace SixLabors.Primitives.Tests
public void EqualityTest(int x, int y)
{
var p1 = new Point(x, y);
- var p2 = new Point(x / 2 - 1, y / 2 - 1);
+ var p2 = new Point((x / 2) - 1, (y / 2) - 1);
var p3 = new Point(x, y);
Assert.True(p1 == p3);
@@ -205,7 +202,7 @@ namespace SixLabors.Primitives.Tests
}
[Fact]
- public static void EqualityTest_NotPoint()
+ public void EqualityTest_NotPoint()
{
var point = new Point(0, 0);
Assert.False(point.Equals(null));
@@ -214,7 +211,7 @@ namespace SixLabors.Primitives.Tests
}
[Fact]
- public static void GetHashCodeTest()
+ public void GetHashCodeTest()
{
var point = new Point(10, 10);
Assert.Equal(point.GetHashCode(), new Point(10, 10).GetHashCode());
diff --git a/tests/SixLabors.Core.Tests/Primitives/RectangleFTests.cs b/tests/SixLabors.Core.Tests/Primitives/RectangleFTests.cs
index 4dc7d9d35a..a202cc6dea 100644
--- a/tests/SixLabors.Core.Tests/Primitives/RectangleFTests.cs
+++ b/tests/SixLabors.Core.Tests/Primitives/RectangleFTests.cs
@@ -1,16 +1,13 @@
-//
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-//
+
+using System;
+using System.Globalization;
+using System.Reflection;
+using Xunit;
namespace SixLabors.Primitives.Tests
{
- using System;
- using System.Globalization;
- using System.Reflection;
-
- using Xunit;
-
///
/// Tests the struct.
///
@@ -19,7 +16,7 @@ namespace SixLabors.Primitives.Tests
[Fact]
public void DefaultConstructorTest()
{
- Assert.Equal(RectangleF.Empty, new RectangleF());
+ Assert.Equal(RectangleF.Empty, default(RectangleF));
}
[Theory]
@@ -77,7 +74,7 @@ namespace SixLabors.Primitives.Tests
public void IsEmptyTest()
{
Assert.True(RectangleF.Empty.IsEmpty);
- Assert.True(new RectangleF().IsEmpty);
+ Assert.True(default(RectangleF).IsEmpty);
Assert.True(new RectangleF(1, -2, -10, 10).IsEmpty);
Assert.True(new RectangleF(1, -2, 10, -10).IsEmpty);
Assert.True(new RectangleF(1, -2, 0, 0).IsEmpty);
@@ -88,7 +85,7 @@ namespace SixLabors.Primitives.Tests
[Theory]
[InlineData(0, 0)]
[InlineData(float.MaxValue, float.MinValue)]
- public static void LocationSetTest(float x, float y)
+ public void LocationSetTest(float x, float y)
{
var point = new PointF(x, y);
var rect = new RectangleF(10, 10, 10, 10) { Location = point };
@@ -100,7 +97,7 @@ namespace SixLabors.Primitives.Tests
[Theory]
[InlineData(0, 0)]
[InlineData(float.MaxValue, float.MinValue)]
- public static void SizeSetTest(float x, float y)
+ public void SizeSetTest(float x, float y)
{
var size = new SizeF(x, y);
var rect = new RectangleF(10, 10, 10, 10) { Size = size };
@@ -125,7 +122,7 @@ namespace SixLabors.Primitives.Tests
}
[Fact]
- public static void EqualityTestNotRectangleF()
+ public void EqualityTestNotRectangleF()
{
var rectangle = new RectangleF(0, 0, 0, 0);
Assert.False(rectangle.Equals(null));
@@ -141,7 +138,7 @@ namespace SixLabors.Primitives.Tests
}
[Fact]
- public static void GetHashCodeTest()
+ public void GetHashCodeTest()
{
var rect1 = new RectangleF(10, 10, 10, 10);
var rect2 = new RectangleF(10, 10, 10, 10);
@@ -158,12 +155,12 @@ namespace SixLabors.Primitives.Tests
public void ContainsTest(float x, float y, float width, float height)
{
var rect = new RectangleF(x, y, width, height);
- float X = (x + width) / 2;
- float Y = (y + height) / 2;
- var p = new PointF(X, Y);
- var r = new RectangleF(X, Y, width / 2, height / 2);
+ float x1 = (x + width) / 2;
+ float y1 = (y + height) / 2;
+ var p = new PointF(x1, y1);
+ var r = new RectangleF(x1, y1, width / 2, height / 2);
- Assert.False(rect.Contains(X, Y));
+ Assert.False(rect.Contains(x1, y1));
Assert.False(rect.Contains(p));
Assert.False(rect.Contains(r));
}
@@ -175,7 +172,7 @@ namespace SixLabors.Primitives.Tests
public void InflateTest(float x, float y, float width, float height)
{
var rect = new RectangleF(x, y, width, height);
- var inflatedRect = new RectangleF(x - width, y - height, width + 2 * width, height + 2 * height);
+ var inflatedRect = new RectangleF(x - width, y - height, width + (2 * width), height + (2 * height));
rect.Inflate(width, height);
Assert.Equal(inflatedRect, rect);
@@ -201,7 +198,7 @@ namespace SixLabors.Primitives.Tests
}
[Fact]
- public static void IntersectIntersectingRectsTest()
+ public void IntersectIntersectingRectsTest()
{
var rect1 = new RectangleF(0, 0, 5, 5);
var rect2 = new RectangleF(1, 1, 3, 3);
diff --git a/tests/SixLabors.Core.Tests/Primitives/RectangleTests.cs b/tests/SixLabors.Core.Tests/Primitives/RectangleTests.cs
index 640b27d678..90354bd72e 100644
--- a/tests/SixLabors.Core.Tests/Primitives/RectangleTests.cs
+++ b/tests/SixLabors.Core.Tests/Primitives/RectangleTests.cs
@@ -1,15 +1,12 @@
-//
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-//
+
+using System;
+using System.Globalization;
+using Xunit;
namespace SixLabors.Primitives.Tests
{
- using System;
- using System.Globalization;
-
- using Xunit;
-
///
/// Tests the struct.
///
@@ -18,7 +15,7 @@ namespace SixLabors.Primitives.Tests
[Fact]
public void DefaultConstructorTest()
{
- Assert.Equal(Rectangle.Empty, new Rectangle());
+ Assert.Equal(Rectangle.Empty, default(Rectangle));
}
[Theory]
@@ -51,8 +48,8 @@ namespace SixLabors.Primitives.Tests
public void EmptyTest()
{
Assert.True(Rectangle.Empty.IsEmpty);
+ Assert.True(default(Rectangle).IsEmpty);
Assert.True(new Rectangle(0, 0, 0, 0).IsEmpty);
- Assert.True(new Rectangle().IsEmpty);
}
[Theory]
@@ -107,7 +104,7 @@ namespace SixLabors.Primitives.Tests
[Theory]
[InlineData(0, 0)]
[InlineData(int.MaxValue, int.MinValue)]
- public static void LocationSetTest(int x, int y)
+ public void LocationSetTest(int x, int y)
{
var point = new Point(x, y);
var rect = new Rectangle(10, 10, 10, 10) { Location = point };
@@ -119,7 +116,7 @@ namespace SixLabors.Primitives.Tests
[Theory]
[InlineData(0, 0)]
[InlineData(int.MaxValue, int.MinValue)]
- public static void SizeSetTest(int x, int y)
+ public void SizeSetTest(int x, int y)
{
var size = new Size(x, y);
var rect = new Rectangle(10, 10, 10, 10) { Size = size };
@@ -145,7 +142,7 @@ namespace SixLabors.Primitives.Tests
}
[Fact]
- public static void EqualityTestNotRectangle()
+ public void EqualityTestNotRectangle()
{
var rectangle = new Rectangle(0, 0, 0, 0);
Assert.False(rectangle.Equals(null));
@@ -154,7 +151,7 @@ namespace SixLabors.Primitives.Tests
}
[Fact]
- public static void GetHashCodeTest()
+ public void GetHashCodeTest()
{
var rect1 = new Rectangle(10, 10, 10, 10);
var rect2 = new Rectangle(10, 10, 10, 10);
@@ -193,7 +190,7 @@ namespace SixLabors.Primitives.Tests
[InlineData(0, int.MinValue, int.MaxValue, 0)]
public void ContainsTest(int x, int y, int width, int height)
{
- var rect = new Rectangle(unchecked(2 * x - width), unchecked(2 * y - height), width, height);
+ var rect = new Rectangle(unchecked((2 * x) - width), unchecked((2 * y) - height), width, height);
var p = new Point(x, y);
var r = new Rectangle(x, y, width / 2, height / 2);
@@ -211,7 +208,7 @@ namespace SixLabors.Primitives.Tests
Rectangle inflatedRect, rect = new Rectangle(x, y, width, height);
unchecked
{
- inflatedRect = new Rectangle(x - width, y - height, width + 2 * width, height + 2 * height);
+ inflatedRect = new Rectangle(x - width, y - height, width + (2 * width), height + (2 * height));
}
Assert.Equal(inflatedRect, Rectangle.Inflate(rect, width, height));
@@ -222,7 +219,7 @@ namespace SixLabors.Primitives.Tests
var s = new Size(x, y);
unchecked
{
- inflatedRect = new Rectangle(rect.X - x, rect.Y - y, rect.Width + 2 * x, rect.Height + 2 * y);
+ inflatedRect = new Rectangle(rect.X - x, rect.Y - y, rect.Width + (2 * x), rect.Height + (2 * y));
}
rect.Inflate(s);
@@ -243,7 +240,7 @@ namespace SixLabors.Primitives.Tests
}
[Fact]
- public static void IntersectIntersectingRectsTest()
+ public void IntersectIntersectingRectsTest()
{
var rect1 = new Rectangle(0, 0, 5, 5);
var rect2 = new Rectangle(1, 1, 3, 3);
diff --git a/tests/SixLabors.Core.Tests/Primitives/SizeFTests.cs b/tests/SixLabors.Core.Tests/Primitives/SizeFTests.cs
index 1cd3858c2f..04363fa943 100644
--- a/tests/SixLabors.Core.Tests/Primitives/SizeFTests.cs
+++ b/tests/SixLabors.Core.Tests/Primitives/SizeFTests.cs
@@ -1,21 +1,19 @@
-//
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-//
+
+using System;
+using System.Globalization;
+using System.Reflection;
+using Xunit;
namespace SixLabors.Primitives.Tests
{
- using System;
- using System.Globalization;
- using System.Reflection;
- using Xunit;
-
public class SizeFTests
{
[Fact]
public void DefaultConstructorTest()
{
- Assert.Equal(SizeF.Empty, new SizeF());
+ Assert.Equal(SizeF.Empty, default(SizeF));
}
[Theory]
@@ -47,7 +45,7 @@ namespace SixLabors.Primitives.Tests
public void IsEmptyDefaultsTest()
{
Assert.True(SizeF.Empty.IsEmpty);
- Assert.True(new SizeF().IsEmpty);
+ Assert.True(default(SizeF).IsEmpty);
Assert.True(new SizeF(0, 0).IsEmpty);
}
@@ -106,7 +104,7 @@ namespace SixLabors.Primitives.Tests
}
[Fact]
- public static void EqualityTest_NotSizeF()
+ public void EqualityTest_NotSizeF()
{
var size = new SizeF(0, 0);
Assert.False(size.Equals(null));
@@ -122,7 +120,7 @@ namespace SixLabors.Primitives.Tests
}
[Fact]
- public static void GetHashCodeTest()
+ public void GetHashCodeTest()
{
var size = new SizeF(10, 10);
Assert.Equal(size.GetHashCode(), new SizeF(10, 10).GetHashCode());
diff --git a/tests/SixLabors.Core.Tests/Primitives/SizeTests.cs b/tests/SixLabors.Core.Tests/Primitives/SizeTests.cs
index 0117e5914f..0cfb62dd5c 100644
--- a/tests/SixLabors.Core.Tests/Primitives/SizeTests.cs
+++ b/tests/SixLabors.Core.Tests/Primitives/SizeTests.cs
@@ -1,14 +1,12 @@
-//
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-//
+
+using System;
+using System.Globalization;
+using Xunit;
namespace SixLabors.Primitives.Tests
{
- using System;
- using System.Globalization;
- using Xunit;
-
///
/// Tests the struct.
///
@@ -17,7 +15,7 @@ namespace SixLabors.Primitives.Tests
[Fact]
public void DefaultConstructorTest()
{
- Assert.Equal(Size.Empty, new Size());
+ Assert.Equal(Size.Empty, default(Size));
}
[Theory]
@@ -43,7 +41,7 @@ namespace SixLabors.Primitives.Tests
public void IsEmptyDefaultsTest()
{
Assert.True(Size.Empty.IsEmpty);
- Assert.True(new Size().IsEmpty);
+ Assert.True(default(Size).IsEmpty);
Assert.True(new Size(0, 0).IsEmpty);
}
@@ -162,7 +160,7 @@ namespace SixLabors.Primitives.Tests
}
[Fact]
- public static void EqualityTest_NotSize()
+ public void EqualityTest_NotSize()
{
var size = new Size(0, 0);
Assert.False(size.Equals(null));
@@ -171,7 +169,7 @@ namespace SixLabors.Primitives.Tests
}
[Fact]
- public static void GetHashCodeTest()
+ public void GetHashCodeTest()
{
var size = new Size(10, 10);
Assert.Equal(size.GetHashCode(), new Size(10, 10).GetHashCode());
@@ -238,7 +236,6 @@ namespace SixLabors.Primitives.Tests
Assert.Equal(mulExpected, multiplier * sz1);
}
-
[Theory]
[InlineData(1000, 0.0f)]
[InlineData(1000, 1.0f)]
@@ -285,7 +282,6 @@ namespace SixLabors.Primitives.Tests
Assert.Equal(mulExpected, multiplier * sz1);
}
-
[Fact]
public void DivideByZeroChecks()
{
diff --git a/tests/SixLabors.Core.Tests/SixLabors.Core.Tests.csproj b/tests/SixLabors.Core.Tests/SixLabors.Core.Tests.csproj
index cd34a8421a..a80bf5a60e 100644
--- a/tests/SixLabors.Core.Tests/SixLabors.Core.Tests.csproj
+++ b/tests/SixLabors.Core.Tests/SixLabors.Core.Tests.csproj
@@ -16,7 +16,17 @@
SixLabors.Tests
+
+ ..\SixLabors.ruleset
+
+
+
+
+
+
+
+
diff --git a/tests/SixLabors.ruleset b/tests/SixLabors.ruleset
new file mode 100644
index 0000000000..9729157125
--- /dev/null
+++ b/tests/SixLabors.ruleset
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+