migrate all tests to xunit
This commit is contained in:
parent
829b9df78e
commit
f10e0a689f
@ -1,98 +1,97 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using Xunit;
|
||||
|
||||
namespace SemiColinGames.Tests {
|
||||
[TestClass]
|
||||
public class GeometryTests {
|
||||
|
||||
public void AssertVectorsAreEqual(Vector2 v1, Vector2 v2) {
|
||||
Assert.AreEqual(v1.X, v2.X, 1e-5);
|
||||
Assert.AreEqual(v1.Y, v2.Y, 1e-5);
|
||||
private void AssertVectorsEqual(Vector2 v1, Vector2 v2) {
|
||||
Assert.Equal(v1.X, v2.X, 5);
|
||||
Assert.Equal(v1.Y, v2.Y, 5);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestVector2Rotate() {
|
||||
Vector2 v = new Vector2(10, 0);
|
||||
AssertVectorsAreEqual(new Vector2(10, 0), v.Rotate(FMath.DegToRad(0)));
|
||||
AssertVectorsAreEqual(new Vector2(0, 10), v.Rotate(FMath.DegToRad(90)));
|
||||
AssertVectorsAreEqual(new Vector2(-10, 0), v.Rotate(FMath.DegToRad(180)));
|
||||
AssertVectorsAreEqual(new Vector2(0, -10), v.Rotate(FMath.DegToRad(270)));
|
||||
AssertVectorsAreEqual(new Vector2(10, 0), v.Rotate(FMath.DegToRad(360)));
|
||||
AssertVectorsAreEqual(new Vector2(0, 10), v.Rotate(FMath.DegToRad(450)));
|
||||
AssertVectorsEqual(new Vector2(10, 0), v.Rotate(FMath.DegToRad(0)));
|
||||
AssertVectorsEqual(new Vector2(0, 10), v.Rotate(FMath.DegToRad(90)));
|
||||
AssertVectorsEqual(new Vector2(-10, 0), v.Rotate(FMath.DegToRad(180)));
|
||||
AssertVectorsEqual(new Vector2(0, -10), v.Rotate(FMath.DegToRad(270)));
|
||||
AssertVectorsEqual(new Vector2(10, 0), v.Rotate(FMath.DegToRad(360)));
|
||||
AssertVectorsEqual(new Vector2(0, 10), v.Rotate(FMath.DegToRad(450)));
|
||||
|
||||
AssertVectorsAreEqual(new Vector2(0, -10), v.Rotate(FMath.DegToRad(-90)));
|
||||
AssertVectorsAreEqual(new Vector2(-10, 0), v.Rotate(FMath.DegToRad(-180)));
|
||||
AssertVectorsAreEqual(new Vector2(0, 10), v.Rotate(FMath.DegToRad(-270)));
|
||||
AssertVectorsAreEqual(new Vector2(10, 0), v.Rotate(FMath.DegToRad(-360)));
|
||||
AssertVectorsAreEqual(new Vector2(0, -10), v.Rotate(FMath.DegToRad(-450)));
|
||||
AssertVectorsEqual(new Vector2(0, -10), v.Rotate(FMath.DegToRad(-90)));
|
||||
AssertVectorsEqual(new Vector2(-10, 0), v.Rotate(FMath.DegToRad(-180)));
|
||||
AssertVectorsEqual(new Vector2(0, 10), v.Rotate(FMath.DegToRad(-270)));
|
||||
AssertVectorsEqual(new Vector2(10, 0), v.Rotate(FMath.DegToRad(-360)));
|
||||
AssertVectorsEqual(new Vector2(0, -10), v.Rotate(FMath.DegToRad(-450)));
|
||||
|
||||
AssertVectorsAreEqual(new Vector2(7.0710678f, 7.0710678f), v.Rotate(FMath.DegToRad(45)));
|
||||
AssertVectorsAreEqual(new Vector2(8.6602540f, 5f), v.Rotate(FMath.DegToRad(30)));
|
||||
AssertVectorsAreEqual(new Vector2(5f, 8.6602540f), v.Rotate(FMath.DegToRad(60)));
|
||||
AssertVectorsAreEqual(new Vector2(-5f, 8.6602540f), v.Rotate(FMath.DegToRad(120)));
|
||||
AssertVectorsAreEqual(new Vector2(-8.6602540f, 5f), v.Rotate(FMath.DegToRad(150)));
|
||||
AssertVectorsEqual(new Vector2(7.0710678f, 7.0710678f), v.Rotate(FMath.DegToRad(45)));
|
||||
AssertVectorsEqual(new Vector2(8.6602540f, 5f), v.Rotate(FMath.DegToRad(30)));
|
||||
AssertVectorsEqual(new Vector2(5f, 8.6602540f), v.Rotate(FMath.DegToRad(60)));
|
||||
AssertVectorsEqual(new Vector2(-5f, 8.6602540f), v.Rotate(FMath.DegToRad(120)));
|
||||
AssertVectorsEqual(new Vector2(-8.6602540f, 5f), v.Rotate(FMath.DegToRad(150)));
|
||||
|
||||
AssertVectorsAreEqual(new Vector2(7.0710678f, -7.0710678f), v.Rotate(FMath.DegToRad(-45)));
|
||||
AssertVectorsAreEqual(new Vector2(8.6602540f, -5f), v.Rotate(FMath.DegToRad(-30)));
|
||||
AssertVectorsAreEqual(new Vector2(5f, -8.6602540f), v.Rotate(FMath.DegToRad(-60)));
|
||||
AssertVectorsAreEqual(new Vector2(-5f, -8.6602540f), v.Rotate(FMath.DegToRad(-120)));
|
||||
AssertVectorsAreEqual(new Vector2(-8.6602540f, -5f), v.Rotate(FMath.DegToRad(-150)));
|
||||
AssertVectorsEqual(new Vector2(7.0710678f, -7.0710678f), v.Rotate(FMath.DegToRad(-45)));
|
||||
AssertVectorsEqual(new Vector2(8.6602540f, -5f), v.Rotate(FMath.DegToRad(-30)));
|
||||
AssertVectorsEqual(new Vector2(5f, -8.6602540f), v.Rotate(FMath.DegToRad(-60)));
|
||||
AssertVectorsEqual(new Vector2(-5f, -8.6602540f), v.Rotate(FMath.DegToRad(-120)));
|
||||
AssertVectorsEqual(new Vector2(-8.6602540f, -5f), v.Rotate(FMath.DegToRad(-150)));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestIntersectSegmentNotColliding() {
|
||||
AABB box = new AABB(new Vector2(0, 0), new Vector2(8, 8));
|
||||
Assert.IsNull(box.IntersectSegment(new Vector2(-16, -16), new Vector2(32, 0)));
|
||||
Assert.Null(box.IntersectSegment(new Vector2(-16, -16), new Vector2(32, 0)));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestIntersectSegmentHit() {
|
||||
AABB box = new AABB(new Vector2(0, 0), new Vector2(8, 8));
|
||||
var point = new Vector2(-16, 4);
|
||||
var delta = new Vector2(32, 0);
|
||||
Hit? maybeHit = box.IntersectSegment(point, delta);
|
||||
|
||||
Assert.IsNotNull(maybeHit);
|
||||
Assert.NotNull(maybeHit);
|
||||
Hit hit = (Hit) maybeHit;
|
||||
|
||||
Assert.AreEqual(box, hit.Collider);
|
||||
Assert.AreEqual(0.25, hit.Time);
|
||||
Assert.Equal(box, hit.Collider);
|
||||
Assert.Equal(0.25, hit.Time);
|
||||
|
||||
Assert.AreEqual(point.X + delta.X * hit.Time, hit.Position.X);
|
||||
Assert.AreEqual(point.Y + delta.Y * hit.Time, hit.Position.Y);
|
||||
Assert.Equal(point.X + delta.X * hit.Time, hit.Position.X);
|
||||
Assert.Equal(point.Y + delta.Y * hit.Time, hit.Position.Y);
|
||||
|
||||
Assert.AreEqual((1.0f - hit.Time) * -delta.X, hit.Delta.X);
|
||||
Assert.AreEqual((1.0f - hit.Time) * -delta.Y, hit.Delta.Y);
|
||||
Assert.Equal((1.0f - hit.Time) * -delta.X, hit.Delta.X);
|
||||
Assert.Equal((1.0f - hit.Time) * -delta.Y, hit.Delta.Y);
|
||||
|
||||
Assert.AreEqual(-1, hit.Normal.X);
|
||||
Assert.AreEqual(0, hit.Normal.Y);
|
||||
Assert.Equal(-1, hit.Normal.X);
|
||||
Assert.Equal(0, hit.Normal.Y);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestIntersectSegmentFromInsideBox() {
|
||||
AABB box = new AABB(new Vector2(0, 0), new Vector2(8, 8));
|
||||
var point = new Vector2(-4, 4);
|
||||
var delta = new Vector2(32, 0);
|
||||
Hit? maybeHit = box.IntersectSegment(point, delta);
|
||||
|
||||
Assert.IsNotNull(maybeHit);
|
||||
Assert.NotNull(maybeHit);
|
||||
Hit hit = (Hit) maybeHit;
|
||||
|
||||
Assert.AreEqual(box, hit.Collider);
|
||||
Assert.AreEqual(0.0, hit.Time);
|
||||
Assert.Equal(box, hit.Collider);
|
||||
Assert.Equal(0.0, hit.Time);
|
||||
|
||||
Assert.AreEqual(-4, hit.Position.X);
|
||||
Assert.AreEqual(4, hit.Position.Y);
|
||||
Assert.Equal(-4, hit.Position.X);
|
||||
Assert.Equal(4, hit.Position.Y);
|
||||
|
||||
Assert.AreEqual(-delta.X, hit.Delta.X);
|
||||
Assert.AreEqual(-delta.Y, hit.Delta.Y);
|
||||
Assert.Equal(-delta.X, hit.Delta.X);
|
||||
Assert.Equal(-delta.Y, hit.Delta.Y);
|
||||
|
||||
Assert.AreEqual(-1, hit.Normal.X);
|
||||
Assert.AreEqual(0, hit.Normal.Y);
|
||||
Assert.Equal(-1, hit.Normal.X);
|
||||
Assert.Equal(0, hit.Normal.Y);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestIntersectSegmentWithPadding() {
|
||||
AABB box = new AABB(new Vector2(0, 0), new Vector2(8, 8));
|
||||
var point = new Vector2(-16, 4);
|
||||
@ -100,62 +99,62 @@ namespace SemiColinGames.Tests {
|
||||
int padding = 4;
|
||||
Hit? maybeHit = box.IntersectSegment(point, delta, new Vector2(padding, padding));
|
||||
|
||||
Assert.IsNotNull(maybeHit);
|
||||
Assert.NotNull(maybeHit);
|
||||
Hit hit = (Hit) maybeHit;
|
||||
|
||||
Assert.AreEqual(box, hit.Collider);
|
||||
Assert.AreEqual(0.125, hit.Time);
|
||||
Assert.Equal(box, hit.Collider);
|
||||
Assert.Equal(0.125, hit.Time);
|
||||
|
||||
Assert.AreEqual(point.X + delta.X * hit.Time, hit.Position.X);
|
||||
Assert.AreEqual(point.Y + delta.Y * hit.Time, hit.Position.Y);
|
||||
Assert.Equal(point.X + delta.X * hit.Time, hit.Position.X);
|
||||
Assert.Equal(point.Y + delta.Y * hit.Time, hit.Position.Y);
|
||||
|
||||
Assert.AreEqual((1.0f - hit.Time) * -delta.X, hit.Delta.X);
|
||||
Assert.AreEqual((1.0f - hit.Time) * -delta.Y, hit.Delta.Y);
|
||||
Assert.Equal((1.0f - hit.Time) * -delta.X, hit.Delta.X);
|
||||
Assert.Equal((1.0f - hit.Time) * -delta.Y, hit.Delta.Y);
|
||||
|
||||
Assert.AreEqual(-1, hit.Normal.X);
|
||||
Assert.AreEqual(0, hit.Normal.Y);
|
||||
Assert.Equal(-1, hit.Normal.X);
|
||||
Assert.Equal(0, hit.Normal.Y);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestIntersectSegmentFromTwoDirections() {
|
||||
AABB box = new AABB(new Vector2(0, 0), new Vector2(32, 32));
|
||||
var farPos = new Vector2(64, 0);
|
||||
var farToNearDelta = new Vector2(-32, 0);
|
||||
Assert.IsNull(box.IntersectSegment(farPos, farToNearDelta));
|
||||
Assert.Null(box.IntersectSegment(farPos, farToNearDelta));
|
||||
|
||||
var nearPos = new Vector2(32, 0);
|
||||
var nearToFarDelta = new Vector2(32, 0);
|
||||
Assert.IsNull(box.IntersectSegment(nearPos, nearToFarDelta));
|
||||
Assert.Null(box.IntersectSegment(nearPos, nearToFarDelta));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestIntersectSegmentXAxisAligned() {
|
||||
AABB box = new AABB(new Vector2(0, 0), new Vector2(16, 16));
|
||||
var pos = new Vector2(-32, 0);
|
||||
var delta = new Vector2(64, 0);
|
||||
Hit? maybeHit = box.IntersectSegment(pos, delta);
|
||||
|
||||
Assert.IsNotNull(maybeHit);
|
||||
Assert.NotNull(maybeHit);
|
||||
Hit hit = (Hit) maybeHit;
|
||||
|
||||
Assert.AreEqual(0.25, hit.Time);
|
||||
Assert.AreEqual(-1, hit.Normal.X);
|
||||
Assert.AreEqual(0, hit.Normal.Y);
|
||||
Assert.Equal(0.25, hit.Time);
|
||||
Assert.Equal(-1, hit.Normal.X);
|
||||
Assert.Equal(0, hit.Normal.Y);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestIntersectSegmentYAxisAligned() {
|
||||
AABB box = new AABB(new Vector2(0, 0), new Vector2(16, 16));
|
||||
var pos = new Vector2(0, -32);
|
||||
var delta = new Vector2(0, 64);
|
||||
Hit? maybeHit = box.IntersectSegment(pos, delta);
|
||||
|
||||
Assert.IsNotNull(maybeHit);
|
||||
Assert.NotNull(maybeHit);
|
||||
Hit hit = (Hit) maybeHit;
|
||||
|
||||
Assert.AreEqual(0.25, hit.Time);
|
||||
Assert.AreEqual(0, hit.Normal.X);
|
||||
Assert.AreEqual(-1, hit.Normal.Y);
|
||||
Assert.Equal(0.25, hit.Time);
|
||||
Assert.Equal(0, hit.Normal.X);
|
||||
Assert.Equal(-1, hit.Normal.Y);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using Xunit;
|
||||
|
||||
namespace SemiColinGames.Tests {
|
||||
[TestClass]
|
||||
|
||||
public class HistoryTests {
|
||||
public static int[] ToArray(History<int> history) {
|
||||
int[] result = new int[history.Length];
|
||||
@ -12,44 +12,44 @@ namespace SemiColinGames.Tests {
|
||||
return result;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestLength() {
|
||||
var h = new History<int>(3);
|
||||
Assert.AreEqual(3, h.Length);
|
||||
Assert.Equal(3, h.Length);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestGetFromEmpty() {
|
||||
var ints = new History<int>(3);
|
||||
Assert.AreEqual(0, ints[0]);
|
||||
Assert.AreEqual(0, ints[1]);
|
||||
Assert.AreEqual(0, ints[2]);
|
||||
Assert.Equal(0, ints[0]);
|
||||
Assert.Equal(0, ints[1]);
|
||||
Assert.Equal(0, ints[2]);
|
||||
|
||||
var objects = new History<Object>(1);
|
||||
Assert.AreEqual(null, objects[0]);
|
||||
Assert.Null(objects[0]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestAdds() {
|
||||
var h = new History<int>(3);
|
||||
Assert.AreEqual("0 0 0", String.Join(" ", ToArray(h)));
|
||||
Assert.Equal("0 0 0", String.Join(" ", ToArray(h)));
|
||||
h.Add(2);
|
||||
Assert.AreEqual("2 0 0", String.Join(" ", ToArray(h)));
|
||||
Assert.Equal("2 0 0", String.Join(" ", ToArray(h)));
|
||||
h.Add(3);
|
||||
h.Add(5);
|
||||
Assert.AreEqual("5 3 2", String.Join(" ", ToArray(h)));
|
||||
Assert.Equal("5 3 2", String.Join(" ", ToArray(h)));
|
||||
h.Add(7);
|
||||
Assert.AreEqual("7 5 3", String.Join(" ", ToArray(h)));
|
||||
Assert.Equal("7 5 3", String.Join(" ", ToArray(h)));
|
||||
h.Add(11);
|
||||
h.Add(13);
|
||||
Assert.AreEqual("13 11 7", String.Join(" ", ToArray(h)));
|
||||
Assert.Equal("13 11 7", String.Join(" ", ToArray(h)));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestThrowsExceptions() {
|
||||
var h = new History<int>(3);
|
||||
Assert.ThrowsException<IndexOutOfRangeException>(() => h[-1]);
|
||||
Assert.ThrowsException<IndexOutOfRangeException>(() => h[3]);
|
||||
Assert.Throws<IndexOutOfRangeException>(() => h[-1]);
|
||||
Assert.Throws<IndexOutOfRangeException>(() => h[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,20 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xunit;
|
||||
|
||||
namespace SemiColinGames.Tests {
|
||||
[TestClass]
|
||||
public class LineTests {
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeSinglePoint() {
|
||||
var p1 = new Point(10, 10);
|
||||
var expected = new Point[] { p1 };
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p1, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeHorizontal() {
|
||||
var p1 = new Point(10, 10);
|
||||
var p2 = new Point(15, 10);
|
||||
@ -29,10 +28,10 @@ namespace SemiColinGames.Tests {
|
||||
};
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p2, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeHorizontalReverse() {
|
||||
var p1 = new Point(15, 10);
|
||||
var p2 = new Point(10, 10);
|
||||
@ -46,10 +45,10 @@ namespace SemiColinGames.Tests {
|
||||
};
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p2, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeVertical() {
|
||||
var p1 = new Point(10, 10);
|
||||
var p2 = new Point(10, 15);
|
||||
@ -63,10 +62,10 @@ namespace SemiColinGames.Tests {
|
||||
};
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p2, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeVerticalReverse() {
|
||||
var p1 = new Point(10, 15);
|
||||
var p2 = new Point(10, 10);
|
||||
@ -80,10 +79,10 @@ namespace SemiColinGames.Tests {
|
||||
};
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p2, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeDiagonalPosPos() {
|
||||
var p1 = new Point(0, 0);
|
||||
var p2 = new Point(5, 5);
|
||||
@ -97,10 +96,10 @@ namespace SemiColinGames.Tests {
|
||||
};
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p2, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeDiagonalPosNeg() {
|
||||
var p1 = new Point(0, 5);
|
||||
var p2 = new Point(5, 0);
|
||||
@ -114,10 +113,10 @@ namespace SemiColinGames.Tests {
|
||||
};
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p2, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeDiagonalNegPos() {
|
||||
var p1 = new Point(5, 0);
|
||||
var p2 = new Point(0, 5);
|
||||
@ -131,10 +130,10 @@ namespace SemiColinGames.Tests {
|
||||
};
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p2, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeDiagonalNegNeg() {
|
||||
var p1 = new Point(5, 5);
|
||||
var p2 = new Point(0, 0);
|
||||
@ -148,10 +147,10 @@ namespace SemiColinGames.Tests {
|
||||
};
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p2, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeDoubleSlope() {
|
||||
var p1 = new Point(0, 0);
|
||||
var p2 = new Point(4, 9);
|
||||
@ -169,10 +168,10 @@ namespace SemiColinGames.Tests {
|
||||
};
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p2, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeDoubleSlopePlusOne() {
|
||||
var p1 = new Point(0, 0);
|
||||
var p2 = new Point(5, 10);
|
||||
@ -191,10 +190,10 @@ namespace SemiColinGames.Tests {
|
||||
};
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p2, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeDoubleSlopePlusOneReverse() {
|
||||
var p1 = new Point(5, 10);
|
||||
var p2 = new Point(0, 0);
|
||||
@ -213,10 +212,10 @@ namespace SemiColinGames.Tests {
|
||||
};
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p2, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeHalfSlope() {
|
||||
var p1 = new Point(0, 0);
|
||||
var p2 = new Point(9, 4);
|
||||
@ -234,10 +233,10 @@ namespace SemiColinGames.Tests {
|
||||
};
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p2, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeHalfSlopePlusOne() {
|
||||
var p1 = new Point(0, 0);
|
||||
var p2 = new Point(10, 5);
|
||||
@ -256,10 +255,10 @@ namespace SemiColinGames.Tests {
|
||||
};
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p2, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[Fact]
|
||||
public void TestRasterizeHalfSlopePlusOneReverse() {
|
||||
var p1 = new Point(10, 5);
|
||||
var p2 = new Point(0, 0);
|
||||
@ -278,7 +277,7 @@ namespace SemiColinGames.Tests {
|
||||
};
|
||||
var result = new List<Point>();
|
||||
Line.Rasterize(p1, p2, result);
|
||||
CollectionAssert.AreEqual(expected, result);
|
||||
Assert.Equal(expected, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("SharedTests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("SharedTests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("c86694a5-dd99-4421-aa2c-1230f11c10f8")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@ -1,81 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{C86694A5-DD99-4421-AA2C-1230F11C10F8}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SemiColinGames.Tests</RootNamespace>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<AssemblyName>SharedTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TargetFramework>netcoreapp5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MonoGame.Framework, Version=3.8.0.1641, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\MonoGame.Framework.DesktopGL.3.8.0.1641\lib\net452\MonoGame.Framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GeometryTests.cs" />
|
||||
<Compile Include="HistoryTests.cs" />
|
||||
<Compile Include="LineTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
|
||||
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.*" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="..\Shared\Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
<Error Condition="!Exists('..\..\packages\MonoGame.Framework.DesktopGL.3.8.0.1641\build\MonoGame.Framework.DesktopGL.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MonoGame.Framework.DesktopGL.3.8.0.1641\build\MonoGame.Framework.DesktopGL.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
|
||||
<Import Project="..\..\packages\MonoGame.Framework.DesktopGL.3.8.0.1641\build\MonoGame.Framework.DesktopGL.targets" Condition="Exists('..\..\packages\MonoGame.Framework.DesktopGL.3.8.0.1641\build\MonoGame.Framework.DesktopGL.targets')" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="SharpDX" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MonoGame.Framework.DesktopGL" version="3.8.0.1641" targetFramework="net472" />
|
||||
<package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net472" />
|
||||
<package id="MSTest.TestFramework" version="2.1.2" targetFramework="net472" />
|
||||
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
|
||||
</packages>
|
Loading…
Reference in New Issue
Block a user