converted all of the unit tests to xunit

This commit is contained in:
Dylan Wilson
2018-05-12 21:05:02 +10:00
parent bcd9171317
commit b4860bd4bb
50 changed files with 980 additions and 1005 deletions
+7
View File
@@ -115,6 +115,13 @@ namespace Tweening
_spriteBatch.FillRectangle(Elastic.X, Elastic.Y, Size.X, Size.X, Color.Yellow);
_spriteBatch.DrawString(_bitmapFont, $"{_tweener.AllocationCount}", Vector2.One, Color.WhiteSmoke);
_spriteBatch.DrawString(_bitmapFont, "fox", new Vector2(100, 100), Color.Honeydew);
var r = _bitmapFont.GetStringRectangle("fox", new Point2(100, 100));
var s = _bitmapFont.MeasureString("fox");
_spriteBatch.DrawRectangle(r, Color.Red);
_spriteBatch.DrawRectangle(new RectangleF(r.X, r.Y, s.Width, s.Height), Color.Green);
_spriteBatch.End();
base.Draw(gameTime);
+55
View File
@@ -88,6 +88,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tweening", "Demos\Tweening\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonoGame.Extended.Tests", "Tests\MonoGame.Extended.Tests\MonoGame.Extended.Tests.csproj", "{F54F8F82-7B7D-4C96-B22D-D4B2F5C2E9F6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonoGame.Extended.Content.Pipeline.Tests", "Tests\MonoGame.Extended.Content.Pipeline.Tests\MonoGame.Extended.Content.Pipeline.Tests.csproj", "{65D54A69-65AE-4DAB-A1EB-EC7AAEF1FEB1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonoGame.Extended.Content.Pipeline.Tests.Tiled", "Tests\MonoGame.Extended.Content.Pipeline.Tests.Tiled\MonoGame.Extended.Content.Pipeline.Tests.Tiled.csproj", "{2A10414F-D3A1-4088-B056-5C9DD387C153}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonoGame.Extended.Entities.Tests", "Tests\MonoGame.Extended.Entities.Tests\MonoGame.Extended.Entities.Tests.csproj", "{F39A4B4A-F5DE-4996-86A4-949B91E5604A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Extended.Gui.Tests", "Tests\MonoGame.Extended.Gui.Tests\MonoGame.Extended.Gui.Tests.csproj", "{43CBA868-9BFC-4E02-8A7A-142C603B087E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonoGame.Extended.Tiled.Tests", "Tests\MonoGame.Extended.Tiled.Tests\MonoGame.Extended.Tiled.Tests.csproj", "{34841DEB-EEC0-477C-B19D-CBB6DF49ED39}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -232,6 +242,46 @@ Global
{F54F8F82-7B7D-4C96-B22D-D4B2F5C2E9F6}.Release|Any CPU.Build.0 = Release|Any CPU
{F54F8F82-7B7D-4C96-B22D-D4B2F5C2E9F6}.Release|x86.ActiveCfg = Release|Any CPU
{F54F8F82-7B7D-4C96-B22D-D4B2F5C2E9F6}.Release|x86.Build.0 = Release|Any CPU
{65D54A69-65AE-4DAB-A1EB-EC7AAEF1FEB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{65D54A69-65AE-4DAB-A1EB-EC7AAEF1FEB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{65D54A69-65AE-4DAB-A1EB-EC7AAEF1FEB1}.Debug|x86.ActiveCfg = Debug|Any CPU
{65D54A69-65AE-4DAB-A1EB-EC7AAEF1FEB1}.Debug|x86.Build.0 = Debug|Any CPU
{65D54A69-65AE-4DAB-A1EB-EC7AAEF1FEB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{65D54A69-65AE-4DAB-A1EB-EC7AAEF1FEB1}.Release|Any CPU.Build.0 = Release|Any CPU
{65D54A69-65AE-4DAB-A1EB-EC7AAEF1FEB1}.Release|x86.ActiveCfg = Release|Any CPU
{65D54A69-65AE-4DAB-A1EB-EC7AAEF1FEB1}.Release|x86.Build.0 = Release|Any CPU
{2A10414F-D3A1-4088-B056-5C9DD387C153}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A10414F-D3A1-4088-B056-5C9DD387C153}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A10414F-D3A1-4088-B056-5C9DD387C153}.Debug|x86.ActiveCfg = Debug|Any CPU
{2A10414F-D3A1-4088-B056-5C9DD387C153}.Debug|x86.Build.0 = Debug|Any CPU
{2A10414F-D3A1-4088-B056-5C9DD387C153}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A10414F-D3A1-4088-B056-5C9DD387C153}.Release|Any CPU.Build.0 = Release|Any CPU
{2A10414F-D3A1-4088-B056-5C9DD387C153}.Release|x86.ActiveCfg = Release|Any CPU
{2A10414F-D3A1-4088-B056-5C9DD387C153}.Release|x86.Build.0 = Release|Any CPU
{F39A4B4A-F5DE-4996-86A4-949B91E5604A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F39A4B4A-F5DE-4996-86A4-949B91E5604A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F39A4B4A-F5DE-4996-86A4-949B91E5604A}.Debug|x86.ActiveCfg = Debug|Any CPU
{F39A4B4A-F5DE-4996-86A4-949B91E5604A}.Debug|x86.Build.0 = Debug|Any CPU
{F39A4B4A-F5DE-4996-86A4-949B91E5604A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F39A4B4A-F5DE-4996-86A4-949B91E5604A}.Release|Any CPU.Build.0 = Release|Any CPU
{F39A4B4A-F5DE-4996-86A4-949B91E5604A}.Release|x86.ActiveCfg = Release|Any CPU
{F39A4B4A-F5DE-4996-86A4-949B91E5604A}.Release|x86.Build.0 = Release|Any CPU
{43CBA868-9BFC-4E02-8A7A-142C603B087E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{43CBA868-9BFC-4E02-8A7A-142C603B087E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{43CBA868-9BFC-4E02-8A7A-142C603B087E}.Debug|x86.ActiveCfg = Debug|Any CPU
{43CBA868-9BFC-4E02-8A7A-142C603B087E}.Debug|x86.Build.0 = Debug|Any CPU
{43CBA868-9BFC-4E02-8A7A-142C603B087E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{43CBA868-9BFC-4E02-8A7A-142C603B087E}.Release|Any CPU.Build.0 = Release|Any CPU
{43CBA868-9BFC-4E02-8A7A-142C603B087E}.Release|x86.ActiveCfg = Release|Any CPU
{43CBA868-9BFC-4E02-8A7A-142C603B087E}.Release|x86.Build.0 = Release|Any CPU
{34841DEB-EEC0-477C-B19D-CBB6DF49ED39}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{34841DEB-EEC0-477C-B19D-CBB6DF49ED39}.Debug|Any CPU.Build.0 = Debug|Any CPU
{34841DEB-EEC0-477C-B19D-CBB6DF49ED39}.Debug|x86.ActiveCfg = Debug|Any CPU
{34841DEB-EEC0-477C-B19D-CBB6DF49ED39}.Debug|x86.Build.0 = Debug|Any CPU
{34841DEB-EEC0-477C-B19D-CBB6DF49ED39}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34841DEB-EEC0-477C-B19D-CBB6DF49ED39}.Release|Any CPU.Build.0 = Release|Any CPU
{34841DEB-EEC0-477C-B19D-CBB6DF49ED39}.Release|x86.ActiveCfg = Release|Any CPU
{34841DEB-EEC0-477C-B19D-CBB6DF49ED39}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -242,6 +292,11 @@ Global
{1DDD3C52-B2F2-4DB3-8BF9-57BD93928EA8} = {932F8931-4A8D-4205-BFCF-98E794207786}
{F46BC5FE-4939-4069-911F-5774AB0A3F51} = {932F8931-4A8D-4205-BFCF-98E794207786}
{F54F8F82-7B7D-4C96-B22D-D4B2F5C2E9F6} = {E5A148A1-DE7B-4D17-ABE8-831B9673B863}
{65D54A69-65AE-4DAB-A1EB-EC7AAEF1FEB1} = {E5A148A1-DE7B-4D17-ABE8-831B9673B863}
{2A10414F-D3A1-4088-B056-5C9DD387C153} = {E5A148A1-DE7B-4D17-ABE8-831B9673B863}
{F39A4B4A-F5DE-4996-86A4-949B91E5604A} = {E5A148A1-DE7B-4D17-ABE8-831B9673B863}
{43CBA868-9BFC-4E02-8A7A-142C603B087E} = {E5A148A1-DE7B-4D17-ABE8-831B9673B863}
{34841DEB-EEC0-477C-B19D-CBB6DF49ED39} = {E5A148A1-DE7B-4D17-ABE8-831B9673B863}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8ED5A62D-25EC-4331-9F99-BDD1E10C02A0}
@@ -48,11 +48,15 @@ namespace MonoGame.Extended.BitmapFonts
return new Size2(stringRectangle.Width, stringRectangle.Height);
}
public RectangleF GetStringRectangle(string text, Point2? position = null)
public RectangleF GetStringRectangle(string text)
{
var position1 = position ?? new Point2();
var glyphs = GetGlyphs(text, position1);
var rectangle = new RectangleF(position1.X, position1.Y, 0, LineHeight);
return GetStringRectangle(text, Point2.Zero);
}
public RectangleF GetStringRectangle(string text, Point2 position)
{
var glyphs = GetGlyphs(text, position);
var rectangle = new RectangleF(position.X, position.Y, 0, LineHeight);
foreach (var glyph in glyphs)
{
@@ -183,10 +187,9 @@ namespace MonoGame.Extended.BitmapFonts
_positionDelta.X += _currentGlyph.FontRegion.XAdvance + _font.LetterSpacing;
}
if (UseKernings && _previousGlyph.HasValue && _previousGlyph.Value.FontRegion != null)
if (UseKernings && _previousGlyph?.FontRegion != null)
{
int amount;
if (_previousGlyph.Value.FontRegion.Kernings.TryGetValue(character, out amount))
if (_previousGlyph.Value.FontRegion.Kernings.TryGetValue(character, out var amount))
{
_positionDelta.X += amount;
_currentGlyph.Position.X += amount;
@@ -28,8 +28,6 @@ namespace MonoGame.Extended.TextureAtlases
public TextureRegion2D(string name, Texture2D texture, int x, int y, int width, int height)
{
if (texture == null) throw new ArgumentNullException(nameof(texture));
Name = name;
Texture = texture;
X = x;
@@ -3,10 +3,17 @@
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.7.0.7" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MonoGame.Extended.Content.Pipeline\MonoGame.Extended.Content.Pipeline.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
@@ -2,10 +2,10 @@
//namespace MonoGame.Extended.Content.Pipeline.Tests.Tiled
//{
// [TestFixture]
//
// public class TiledMapImporterProcessorTests
// {
// [Test]
// [Fact]
// public void TiledMapImporter_Import_Test()
// {
// var filePath = PathExtensions.GetApplicationFullPath("TestData", "level01.tmx");
@@ -17,67 +17,67 @@
// var map = importer.Import(filePath, importerContext);
// Assert.AreEqual("1.0", map.Version);
// Assert.AreEqual(TmxOrientation.Orthogonal, map.Orientation);
// Assert.AreEqual(TmxRenderOrder.RightDown, map.RenderOrder);
// Assert.AreEqual(20, map.Width);
// Assert.AreEqual(10, map.Height);
// Assert.AreEqual(128, map.TileWidth);
// Assert.AreEqual(128, map.TileHeight);
// Assert.AreEqual("#7d7d7d", map.BackgroundColor);
// Assert.AreEqual("awesome", map.Properties[0].Name);
// Assert.AreEqual("42", map.Properties[0].Value);
// Assert.AreEqual(1, map.Tilesets.Count);
// Assert.AreEqual(3, map.Layers.Count);
// Assert.AreEqual(TmxOrientation.Orthogonal,map.Orientation);
// Assert.Equal("1.0", map.Version);
// Assert.Equal(TmxOrientation.Orthogonal, map.Orientation);
// Assert.Equal(TmxRenderOrder.RightDown, map.RenderOrder);
// Assert.Equal(20, map.Width);
// Assert.Equal(10, map.Height);
// Assert.Equal(128, map.TileWidth);
// Assert.Equal(128, map.TileHeight);
// Assert.Equal("#7d7d7d", map.BackgroundColor);
// Assert.Equal("awesome", map.Properties[0].Name);
// Assert.Equal("42", map.Properties[0].Value);
// Assert.Equal(1, map.Tilesets.Count);
// Assert.Equal(3, map.Layers.Count);
// Assert.Equal(TmxOrientation.Orthogonal,map.Orientation);
// var tileset = map.Tilesets.First();
// Assert.AreEqual(1, tileset.FirstGlobalIdentifier);
// Assert.AreEqual("free-tileset.png", tileset.Image.Source);
// Assert.AreEqual(652, tileset.Image.Width);
// Assert.AreEqual(783, tileset.Image.Height);
// Assert.AreEqual(2, tileset.Margin);
// Assert.AreEqual(30, tileset.TileCount);
// Assert.AreEqual("free-tileset", tileset.Name);
// Assert.AreEqual(null, tileset.Source);
// Assert.AreEqual(2, tileset.Spacing);
// Assert.AreEqual(0, tileset.TerrainTypes.Count);
// Assert.AreEqual(0, tileset.Properties.Count);
// Assert.AreEqual(128, tileset.TileHeight);
// Assert.AreEqual(128, tileset.TileWidth);
// Assert.AreEqual(0, tileset.TileOffset.X);
// Assert.AreEqual(0, tileset.TileOffset.Y);
// Assert.Equal(1, tileset.FirstGlobalIdentifier);
// Assert.Equal("free-tileset.png", tileset.Image.Source);
// Assert.Equal(652, tileset.Image.Width);
// Assert.Equal(783, tileset.Image.Height);
// Assert.Equal(2, tileset.Margin);
// Assert.Equal(30, tileset.TileCount);
// Assert.Equal("free-tileset", tileset.Name);
// Assert.Equal(null, tileset.Source);
// Assert.Equal(2, tileset.Spacing);
// Assert.Equal(0, tileset.TerrainTypes.Count);
// Assert.Equal(0, tileset.Properties.Count);
// Assert.Equal(128, tileset.TileHeight);
// Assert.Equal(128, tileset.TileWidth);
// Assert.Equal(0, tileset.TileOffset.X);
// Assert.Equal(0, tileset.TileOffset.Y);
// var tileLayer2 = (TmxTileLayer) map.Layers[0];
// Assert.AreEqual("Tile Layer 2", tileLayer2.Name);
// Assert.AreEqual(1, tileLayer2.Opacity);
// Assert.AreEqual(0, tileLayer2.Properties.Count);
// Assert.AreEqual(true, tileLayer2.Visible);
// Assert.AreEqual(200, tileLayer2.Data.Tiles.Count);
// Assert.AreEqual(0, tileLayer2.X);
// Assert.AreEqual(0, tileLayer2.Y);
// Assert.Equal("Tile Layer 2", tileLayer2.Name);
// Assert.Equal(1, tileLayer2.Opacity);
// Assert.Equal(0, tileLayer2.Properties.Count);
// Assert.Equal(true, tileLayer2.Visible);
// Assert.Equal(200, tileLayer2.Data.Tiles.Count);
// Assert.Equal(0, tileLayer2.X);
// Assert.Equal(0, tileLayer2.Y);
// var imageLayer = (TmxImageLayer)map.Layers[1];
// Assert.AreEqual("Image Layer 1", imageLayer.Name);
// Assert.AreEqual(1, imageLayer.Opacity);
// Assert.AreEqual(0, imageLayer.Properties.Count);
// Assert.AreEqual(true, imageLayer.Visible);
// Assert.AreEqual("hills.png", imageLayer.Image.Source);
// Assert.AreEqual(100, imageLayer.X);
// Assert.AreEqual(100, imageLayer.Y);
// Assert.Equal("Image Layer 1", imageLayer.Name);
// Assert.Equal(1, imageLayer.Opacity);
// Assert.Equal(0, imageLayer.Properties.Count);
// Assert.Equal(true, imageLayer.Visible);
// Assert.Equal("hills.png", imageLayer.Image.Source);
// Assert.Equal(100, imageLayer.X);
// Assert.Equal(100, imageLayer.Y);
// var tileLayer1 = (TmxTileLayer)map.Layers[2];
// Assert.AreEqual("Tile Layer 1", tileLayer1.Name);
// Assert.AreEqual(2, tileLayer1.Properties.Count);
// Assert.Equal("Tile Layer 1", tileLayer1.Name);
// Assert.Equal(2, tileLayer1.Properties.Count);
// Assert.AreEqual("customlayerprop", tileLayer1.Properties[0].Name);
// Assert.AreEqual("1", tileLayer1.Properties[0].Value);
// Assert.Equal("customlayerprop", tileLayer1.Properties[0].Name);
// Assert.Equal("1", tileLayer1.Properties[0].Value);
// Assert.AreEqual("customlayerprop2", tileLayer1.Properties[1].Name);
// Assert.AreEqual("2", tileLayer1.Properties[1].Value);
// Assert.Equal("customlayerprop2", tileLayer1.Properties[1].Name);
// Assert.Equal("2", tileLayer1.Properties[1].Value);
// }
// [Test]
// [Fact]
// public void TiledMapImporter_Xml_Test()
// {
// var filePath = PathExtensions.GetApplicationFullPath("TestData", "test-tileset-xml.tmx");
@@ -90,7 +90,7 @@
// Assert.IsTrue(new uint[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }.SequenceEqual(actualData));
// }
// [Test]
// [Fact]
// public void TiledMapImporter_Csv_Test()
// {
// var filePath = PathExtensions.GetApplicationFullPath("TestData", "test-tileset-csv.tmx");
@@ -98,12 +98,12 @@
// var layer = map.Layers.OfType<TmxTileLayer>().First();
// var data = layer.Data.Tiles.Select(i => i.GlobalIdentifier).ToArray();
// Assert.AreEqual("csv", layer.Data.Encoding);
// Assert.Equal("csv", layer.Data.Encoding);
// Assert.IsNull(layer.Data.Compression);
// Assert.IsTrue(new uint[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }.SequenceEqual(data));
// }
// [Test]
// [Fact]
// public void TiledMapImporter_Base64_Test()
// {
// var filePath = PathExtensions.GetApplicationFullPath("TestData", "test-tileset-base64.tmx");
@@ -111,12 +111,12 @@
// var layer = map.Layers.OfType<TmxTileLayer>().First();
// var data = layer.Data.Tiles.Select(i => i.GlobalIdentifier).ToArray();
// Assert.AreEqual("base64", layer.Data.Encoding);
// Assert.Equal("base64", layer.Data.Encoding);
// Assert.IsNull(layer.Data.Compression);
// Assert.IsTrue(new uint[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }.SequenceEqual(data));
// }
// [Test]
// [Fact]
// public void TiledMapImporter_Gzip_Test()
// {
// var filePath = PathExtensions.GetApplicationFullPath("TestData", "test-tileset-gzip.tmx");
@@ -124,13 +124,13 @@
// var layer = map.Layers.OfType<TmxTileLayer>().First();
// var data = layer.Data.Tiles.Select(i => i.GlobalIdentifier).ToArray();
// Assert.AreEqual("base64", layer.Data.Encoding);
// Assert.AreEqual("gzip", layer.Data.Compression);
// Assert.Equal("base64", layer.Data.Encoding);
// Assert.Equal("gzip", layer.Data.Compression);
// Assert.IsTrue(new uint[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }.SequenceEqual(data));
// }
// [Test]
// [Fact]
// public void TiledMapImporter_Zlib_Test()
// {
// var filePath = PathExtensions.GetApplicationFullPath("TestData", "test-tileset-zlib.tmx");
@@ -138,42 +138,42 @@
// var layer = map.Layers.OfType<TmxTileLayer>().First();
// var data = layer.Data.Tiles.Select(i => i.GlobalIdentifier).ToArray();
// Assert.AreEqual("base64", layer.Data.Encoding);
// Assert.AreEqual("zlib", layer.Data.Compression);
// Assert.Equal("base64", layer.Data.Encoding);
// Assert.Equal("zlib", layer.Data.Compression);
// Assert.IsTrue(new uint[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }.SequenceEqual(data));
// }
// [Test]
// [Fact]
// public void TiledMapImporter_ObjectLayer_Test()
// {
// var filePath = PathExtensions.GetApplicationFullPath("TestData", "test-object-layer.tmx");
// var map = ImportAndProcessMap(filePath);
// Assert.AreEqual(1, map.Layers.Count);
// Assert.Equal(1, map.Layers.Count);
// Assert.IsInstanceOf<TmxObjectLayer>(map.Layers[0]);
// var tmxObjectGroup = map.Layers[0] as TmxObjectLayer;
// var tmxObject = tmxObjectGroup.Objects[0];
// var tmxPolygon = tmxObjectGroup.Objects[3].Polygon;
// var tmxPolyline = tmxObjectGroup.Objects[4].Polyline;
// Assert.AreEqual("Object Layer 1", tmxObjectGroup.Name);
// Assert.AreEqual(1, tmxObject.Identifier);
// Assert.AreEqual(131.345f, tmxObject.X);
// Assert.AreEqual(65.234f, tmxObject.Y);
// Assert.AreEqual(311.111f, tmxObject.Width);
// Assert.AreEqual(311.232f, tmxObject.Height);
// Assert.AreEqual(1, tmxObject.Properties.Count);
// Assert.AreEqual("shape", tmxObject.Properties[0].Name);
// Assert.AreEqual("circle", tmxObject.Properties[0].Value);
// Assert.IsNotNull(tmxObject.Ellipse);
// Assert.Equal("Object Layer 1", tmxObjectGroup.Name);
// Assert.Equal(1, tmxObject.Identifier);
// Assert.Equal(131.345f, tmxObject.X);
// Assert.Equal(65.234f, tmxObject.Y);
// Assert.Equal(311.111f, tmxObject.Width);
// Assert.Equal(311.232f, tmxObject.Height);
// Assert.Equal(1, tmxObject.Properties.Count);
// Assert.Equal("shape", tmxObject.Properties[0].Name);
// Assert.Equal("circle", tmxObject.Properties[0].Value);
// Assert.NotNull(tmxObject.Ellipse);
// Assert.IsFalse(tmxObjectGroup.Objects[1].Visible);
// Assert.AreEqual(-1, tmxObjectGroup.Objects[1].GlobalIdentifier);
// Assert.AreEqual(23, tmxObjectGroup.Objects[5].GlobalIdentifier);
// Assert.AreEqual("rectangle", tmxObjectGroup.Objects[2].Type);
// Assert.IsNotNull(tmxPolygon);
// Assert.AreEqual("0,0 180,90 -8,275 -45,81 38,77", tmxPolygon.Points);
// Assert.IsNotNull(tmxPolyline);
// Assert.AreEqual("0,0 28,299 326,413 461,308", tmxPolyline.Points);
// Assert.Equal(-1, tmxObjectGroup.Objects[1].GlobalIdentifier);
// Assert.Equal(23, tmxObjectGroup.Objects[5].GlobalIdentifier);
// Assert.Equal("rectangle", tmxObjectGroup.Objects[2].Type);
// Assert.NotNull(tmxPolygon);
// Assert.Equal("0,0 180,90 -8,275 -45,81 38,77", tmxPolygon.Points);
// Assert.NotNull(tmxPolyline);
// Assert.Equal("0,0 28,299 326,413 461,308", tmxPolyline.Points);
// }
@@ -1,14 +1,14 @@
using System;
using System.IO;
using MonoGame.Extended.Content.Pipeline.Animations;
using NUnit.Framework;
using Xunit;
namespace MonoGame.Extended.Content.Pipeline.Tests
{
[TestFixture]
public class AstridAnimatorImporterTests
{
[Test]
[Fact]
public void AstridAnimatorImporter_Import_Test()
{
var filePath = PathExtensions.GetApplicationFullPath("TestData", "astrid-animator.aa");
@@ -16,19 +16,19 @@ namespace MonoGame.Extended.Content.Pipeline.Tests
var result = importer.Import(filePath, null);
var data = result.Data;
Assert.AreEqual("astrid-animator-atlas.json", data.TextureAtlas);
Assert.AreEqual(2, data.Animations.Count);
Assert.Equal("astrid-animator-atlas.json", data.TextureAtlas);
Assert.Equal(2, data.Animations.Count);
Assert.AreEqual("appear", data.Animations[0].Name);
Assert.AreEqual(8, data.Animations[0].FramesPerSecond);
Assert.AreEqual(2, data.Animations[0].Frames.Count);
Assert.AreEqual("appear_01", data.Animations[0].Frames[0]);
Assert.AreEqual("appear_02", data.Animations[0].Frames[1]);
Assert.Equal("appear", data.Animations[0].Name);
Assert.Equal(8, data.Animations[0].FramesPerSecond);
Assert.Equal(2, data.Animations[0].Frames.Count);
Assert.Equal("appear_01", data.Animations[0].Frames[0]);
Assert.Equal("appear_02", data.Animations[0].Frames[1]);
Assert.AreEqual("die", data.Animations[1].Name);
Assert.AreEqual(16, data.Animations[1].FramesPerSecond);
Assert.AreEqual(1, data.Animations[1].Frames.Count);
Assert.AreEqual("die_01", data.Animations[1].Frames[0]);
Assert.Equal("die", data.Animations[1].Name);
Assert.Equal(16, data.Animations[1].FramesPerSecond);
Assert.Single(data.Animations[1].Frames);
Assert.Equal("die_01", data.Animations[1].Frames[0]);
}
}
}
@@ -1,14 +1,14 @@
using System;
using System.IO;
using MonoGame.Extended.Content.Pipeline.Animations;
using NUnit.Framework;
using Xunit;
namespace MonoGame.Extended.Content.Pipeline.Tests
{
[TestFixture]
public class AstridAnimatorProcessorTests
{
[Test]
[Fact]
public void AstridAnimatorProcessor_Process_Test()
{
var filePath = PathExtensions.GetApplicationFullPath("TestData", "astrid-animator.aa");
@@ -19,12 +19,12 @@ namespace MonoGame.Extended.Content.Pipeline.Tests
var processor = new AstridAnimatorProcessor();
var result = processor.Process(importerResult, null);
Assert.AreEqual("astrid-animator-atlas", result.TextureAtlasAssetName);
Assert.AreEqual("TestData", Path.GetFileName(result.Directory));
Assert.AreEqual(3, result.Frames.Count);
Assert.AreEqual("appear_01", result.Frames[0]);
Assert.AreEqual("appear_02", result.Frames[1]);
Assert.AreEqual("die_01", result.Frames[2]);
Assert.Equal("astrid-animator-atlas", result.TextureAtlasAssetName);
Assert.Equal("TestData", Path.GetFileName(result.Directory));
Assert.Equal(3, result.Frames.Count);
Assert.Equal("appear_01", result.Frames[0]);
Assert.Equal("appear_02", result.Frames[1]);
Assert.Equal("die_01", result.Frames[2]);
}
}
}
@@ -3,10 +3,29 @@
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.7.0.7" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MonoGame.Extended.Content.Pipeline\MonoGame.Extended.Content.Pipeline.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
<None Update="TestData\astrid-animator-atlas.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="TestData\astrid-animator.aa">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="TestData\test-tileset.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
@@ -1,24 +1,24 @@
using Microsoft.Xna.Framework.Content.Pipeline;
using MonoGame.Extended.Content.Pipeline.TextureAtlases;
using NSubstitute;
using NUnit.Framework;
using Xunit;
namespace MonoGame.Extended.Content.Pipeline.Tests
{
[TestFixture]
public class TexturePackerJsonImporterProcessorTests
{
[Test]
[Fact]
public void TexturePackerJsonImporter_Import_Test()
{
var filePath = PathExtensions.GetApplicationFullPath(@"TestData/test-tileset.json");
var importer = new TexturePackerJsonImporter();
var data = importer.Import(filePath, Substitute.For<ContentImporterContext>());
Assert.IsNotNull(data);
Assert.NotNull(data);
}
[Test]
[Fact]
public void TexturePackerJsonImporter_Processor_Test()
{
var filePath = PathExtensions.GetApplicationFullPath(@"TestData/test-tileset.json");
@@ -27,7 +27,7 @@ namespace MonoGame.Extended.Content.Pipeline.Tests
var processor = new TexturePackerProcessor();
var output = processor.Process(input, Substitute.For<ContentProcessorContext>());
Assert.IsNotNull(output);
Assert.NotNull(output);
}
}
}
@@ -2,50 +2,34 @@
using Microsoft.Xna.Framework;
using MonoGame.Extended.Entities;
using MonoGame.Extended.Gui.Tests.Implementation;
using NUnit.Framework;
using Xunit;
namespace MonoGame.Extended.Gui.Tests
{
[TestFixture]
public class EntityTemplateTests
{
[Test]
[Fact]
public void ECS_CreateEntityFromTemplate_Basic_Test()
{
// Seems to work with null.
var ecs = new EntityComponentSystem(null);
ecs.Scan(typeof(EntityTemplateBasic).Assembly);
var manager = ecs.EntityManager;
Entity entity = null;
try
{
entity = manager.CreateEntityFromTemplate(EntityTemplateBasic.Name);
}
catch (Exception e)
{
Assert.Fail("Failed to create entity from template.\n" + e.StackTrace);
}
var entity = manager.CreateEntityFromTemplate(EntityTemplateBasic.Name);
Assert.NotNull(entity);
Assert.NotNull(entity.Get<EntityComponentBasic>());
}
[Test]
[Fact]
public void ECS_CreateEntityFromTemplate_UsingManager_Test()
{
// Seems to work with null.
var ecs = new EntityComponentSystem(null);
ecs.Scan(typeof(EntityTemplateUsingManager).Assembly);
var manager = ecs.EntityManager;
Entity entity = null;
try
{
entity = manager.CreateEntityFromTemplate(EntityTemplateUsingManager.Name);
}
catch (Exception e)
{
Assert.Fail("Failed to create entity from template.\n" + e.StackTrace);
}
var entity = manager.CreateEntityFromTemplate(EntityTemplateUsingManager.Name);
Assert.NotNull(entity);
Assert.NotNull(entity.Get<EntityComponentBasic>());
@@ -3,10 +3,17 @@
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.7.0.7" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MonoGame.Extended.Entities\MonoGame.Extended.Entities.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
@@ -1,123 +1,122 @@
using System.Collections.Generic;
using Microsoft.Xna.Framework.Graphics;
using MonoGame.Extended.BitmapFonts;
using MonoGame.Extended.Gui.Controls;
using MonoGame.Extended.Tests;
using MonoGame.Extended.TextureAtlases;
using NSubstitute;
using NUnit.Framework;
//using System.Collections.Generic;
//using Microsoft.Xna.Framework.Graphics;
//using MonoGame.Extended.BitmapFonts;
//using MonoGame.Extended.Gui.Controls;
//using MonoGame.Extended.Tests;
//using MonoGame.Extended.TextureAtlases;
//using NSubstitute;
//using Xunit;
namespace MonoGame.Extended.Gui.Tests.Controls
{
[TestFixture]
public class GuiButtonTests
{
[Test]
public void DesiredSizeShouldBeEmptyByDefault()
{
var availableSize = new Size2(800, 480);
var context = Substitute.For<IGuiContext>();
var button = new Button();
var desiredSize = button.GetDesiredSize(context, availableSize);
//namespace MonoGame.Extended.Gui.Tests.Controls
//{
// public class GuiButtonTests
// {
// [Fact]
// public void DesiredSizeShouldBeEmptyByDefault()
// {
// var availableSize = new Size2(800, 480);
// var context = Substitute.For<IGuiContext>();
// var button = new Button();
// var desiredSize = button.GetDesiredSize(context, availableSize);
Assert.That(desiredSize, Is.EqualTo(Size2.Empty));
}
// Assert.That(desiredSize, Is.EqualTo(Size2.Empty));
// }
[Test]
public void DesiredSizeShouldBeTheSizeOfTheBackgroundRegion()
{
var availableSize = new Size2(800, 480);
var context = Substitute.For<IGuiContext>();
var backgroundRegion = MockTextureRegion();
var button = new GuiButton { BackgroundRegion = backgroundRegion };
var desiredSize = button.GetDesiredSize(context, availableSize);
// [Fact]
// public void DesiredSizeShouldBeTheSizeOfTheBackgroundRegion()
// {
// var availableSize = new Size2(800, 480);
// var context = Substitute.For<IGuiContext>();
// var backgroundRegion = MockTextureRegion();
// var button = new GuiButton { BackgroundRegion = backgroundRegion };
// var desiredSize = button.GetDesiredSize(context, availableSize);
Assert.That(desiredSize, Is.EqualTo(backgroundRegion.Size));
}
// Assert.That(desiredSize, Is.EqualTo(backgroundRegion.Size));
// }
[Test]
public void DesiredSizeShouldBeTheSizeOfTheMarginsInANinePatchRegion()
{
var availableSize = new Size2(800, 480);
var context = Substitute.For<IGuiContext>();
var texture = new Texture2D(new TestGraphicsDevice(), 512, 512);
var backgroundRegion = new NinePatchRegion2D(new TextureRegion2D(texture), new Thickness(10, 20));
var button = new GuiButton() { BackgroundRegion = backgroundRegion };
var desiredSize = button.GetDesiredSize(context, availableSize);
// [Fact]
// public void DesiredSizeShouldBeTheSizeOfTheMarginsInANinePatchRegion()
// {
// var availableSize = new Size2(800, 480);
// var context = Substitute.For<IGuiContext>();
// var texture = new Texture2D(new TestGraphicsDevice(), 512, 512);
// var backgroundRegion = new NinePatchRegion2D(new TextureRegion2D(texture), new Thickness(10, 20));
// var button = new GuiButton() { BackgroundRegion = backgroundRegion };
// var desiredSize = button.GetDesiredSize(context, availableSize);
Assert.That(desiredSize, Is.EqualTo(new Size2(20, 40)));
}
// Assert.That(desiredSize, Is.EqualTo(new Size2(20, 40)));
// }
[Test]
public void DesiredSizeShouldAtLeastBeTheSizeOfTheText()
{
const string text = "abcdefg";
// [Fact]
// public void DesiredSizeShouldAtLeastBeTheSizeOfTheText()
// {
// const string text = "abcdefg";
var availableSize = new Size2(800, 480);
var context = Substitute.For<IGuiContext>();
var font = CreateMockFont(text, lineHeight: 32);
var expectedSize = font.MeasureString(text);
var button = new GuiButton {Text = text, Font = font};
// var availableSize = new Size2(800, 480);
// var context = Substitute.For<IGuiContext>();
// var font = CreateMockFont(text, lineHeight: 32);
// var expectedSize = font.MeasureString(text);
// var button = new GuiButton {Text = text, Font = font};
var desiredSize = button.GetDesiredSize(context, availableSize);
// var desiredSize = button.GetDesiredSize(context, availableSize);
Assert.That(desiredSize, Is.EqualTo(expectedSize));
}
// Assert.That(desiredSize, Is.EqualTo(expectedSize));
// }
[Test]
public void DesiredSizeShouldAtLeastBeTheSizeOfTheIcon()
{
var texture = new Texture2D(new TestGraphicsDevice(), 35, 38);
var icon = new TextureRegion2D(texture);
// [Fact]
// public void DesiredSizeShouldAtLeastBeTheSizeOfTheIcon()
// {
// var texture = new Texture2D(new TestGraphicsDevice(), 35, 38);
// var icon = new TextureRegion2D(texture);
var availableSize = new Size2(800, 480);
var context = Substitute.For<IGuiContext>();
var button = new GuiButton { IconRegion = icon };
var desiredSize = button.GetDesiredSize(context, availableSize);
// var availableSize = new Size2(800, 480);
// var context = Substitute.For<IGuiContext>();
// var button = new GuiButton { IconRegion = icon };
// var desiredSize = button.GetDesiredSize(context, availableSize);
Assert.That(desiredSize, Is.EqualTo(icon.Size));
}
// Assert.That(desiredSize, Is.EqualTo(icon.Size));
// }
[Test]
public void DesiredSizeShouldBeTheSizeOfTheBiggestTextOrIcon()
{
const string text = "abcdefg";
// [Fact]
// public void DesiredSizeShouldBeTheSizeOfTheBiggestTextOrIcon()
// {
// const string text = "abcdefg";
var texture = new Texture2D(new TestGraphicsDevice(), 35, 38);
var icon = new TextureRegion2D(texture);
var iconExpectedSize = icon.Size;
// var texture = new Texture2D(new TestGraphicsDevice(), 35, 38);
// var icon = new TextureRegion2D(texture);
// var iconExpectedSize = icon.Size;
var availableSize = new Size2(800, 480);
var context = Substitute.For<IGuiContext>();
// var availableSize = new Size2(800, 480);
// var context = Substitute.For<IGuiContext>();
var font = CreateMockFont(text, 32);
var fontExpectedSize = font.MeasureString(text);
// var font = CreateMockFont(text, 32);
// var fontExpectedSize = font.MeasureString(text);
var button = new GuiButton { Text = text, Font = font, IconRegion = icon };
var desiredSize = button.GetDesiredSize(context, availableSize);
// var button = new GuiButton { Text = text, Font = font, IconRegion = icon };
// var desiredSize = button.GetDesiredSize(context, availableSize);
Assert.That(desiredSize.Width, Is.EqualTo(fontExpectedSize.Width));
Assert.That(desiredSize.Height, Is.EqualTo(iconExpectedSize.Height));
}
// Assert.That(desiredSize.Width, Is.EqualTo(fontExpectedSize.Width));
// Assert.That(desiredSize.Height, Is.EqualTo(iconExpectedSize.Height));
// }
private static BitmapFont CreateMockFont(string text, int lineHeight)
{
var regions = new List<BitmapFontRegion>();
var xOffset = 0;
// private static BitmapFont CreateMockFont(string text, int lineHeight)
// {
// var regions = new List<BitmapFontRegion>();
// var xOffset = 0;
foreach (var character in text)
{
regions.Add(new BitmapFontRegion(MockTextureRegion(10, 10), character, xOffset, yOffset: 0, xAdvance: 0));
xOffset += 10;
}
// foreach (var character in text)
// {
// regions.Add(new BitmapFontRegion(MockTextureRegion(10, 10), character, xOffset, yOffset: 0, xAdvance: 0));
// xOffset += 10;
// }
return new BitmapFont("font", regions, lineHeight);
}
// return new BitmapFont("font", regions, lineHeight);
// }
private static TextureRegion2D MockTextureRegion(int width = 100, int height = 200)
{
var texture = new Texture2D(new TestGraphicsDevice(), width, height);
return new TextureRegion2D(texture, 0, 0, width, height);
}
}
}
// private static TextureRegion2D MockTextureRegion(int width = 100, int height = 200)
// {
// var texture = new Texture2D(new TestGraphicsDevice(), width, height);
// return new TextureRegion2D(texture, 0, 0, width, height);
// }
// }
//}
@@ -1,58 +1,58 @@
using MonoGame.Extended.Gui.Controls;
using NSubstitute;
using NUnit.Framework;
//using MonoGame.Extended.Gui.Controls;
//using NSubstitute;
//using Xunit;
namespace MonoGame.Extended.Gui.Tests.Controls
{
[TestFixture]
public class GuiControlCollectionTests
{
[Test]
public void GuiControlCollection_Add_SetsTheParent_Test()
{
var parent = Substitute.For<GuiControl>();
var child = Substitute.For<GuiControl>();
//namespace MonoGame.Extended.Gui.Tests.Controls
//{
// public class GuiControlCollectionTests
// {
// [Fact]
// public void GuiControlCollection_Add_SetsTheParent_Test()
// {
// var parent = Substitute.For<GuiControl>();
// var child = Substitute.For<GuiControl>();
var controls = new GuiControlCollection(parent) { child };
Assert.IsTrue(controls.Contains(child));
Assert.AreSame(parent, child.Parent);
}
// var controls = new GuiControlCollection(parent) { child };
// Assert.IsTrue(controls.Contains(child));
// Assert.AreSame(parent, child.Parent);
// }
[Test]
public void GuiControlCollection_Remove_SetsTheParentToNull_Test()
{
var parent = Substitute.For<GuiControl>();
var child = Substitute.For<GuiControl>();
// [Fact]
// public void GuiControlCollection_Remove_SetsTheParentToNull_Test()
// {
// var parent = Substitute.For<GuiControl>();
// var child = Substitute.For<GuiControl>();
new GuiControlCollection(parent) { child }.Remove(child);
// new GuiControlCollection(parent) { child }.Remove(child);
Assert.IsNull(child.Parent);
}
// Assert.IsNull(child.Parent);
// }
[Test]
public void GuiControlCollection_Insert_SetsTheParent_Test()
{
var parent = Substitute.For<GuiControl>();
var child = Substitute.For<GuiControl>();
// [Fact]
// public void GuiControlCollection_Insert_SetsTheParent_Test()
// {
// var parent = Substitute.For<GuiControl>();
// var child = Substitute.For<GuiControl>();
var controls = new GuiControlCollection(parent);
// var controls = new GuiControlCollection(parent);
controls.Insert(0, child);
Assert.IsTrue(controls.Contains(child));
Assert.AreSame(parent, child.Parent);
}
// controls.Insert(0, child);
// Assert.IsTrue(controls.Contains(child));
// Assert.AreSame(parent, child.Parent);
// }
[Test]
public void GuiControlCollection_Clear_SetsAllTheParentsToNull_Test()
{
var parent = Substitute.For<GuiControl>();
var child0 = Substitute.For<GuiControl>();
var child1 = Substitute.For<GuiControl>();
// [Fact]
// public void GuiControlCollection_Clear_SetsAllTheParentsToNull_Test()
// {
// var parent = Substitute.For<GuiControl>();
// var child0 = Substitute.For<GuiControl>();
// var child1 = Substitute.For<GuiControl>();
new GuiControlCollection(parent) { child0, child1 }.Clear();
// new GuiControlCollection(parent) { child0, child1 }.Clear();
Assert.IsNull(child0.Parent);
Assert.IsNull(child1.Parent);
}
}
}
// Assert.IsNull(child0.Parent);
// Assert.IsNull(child1.Parent);
// }
// }
//}
@@ -1,12 +1,12 @@
using MonoGame.Extended.Gui.Controls;
using NUnit.Framework;
using Xunit;
namespace MonoGame.Extended.Gui.Tests
{
//[TestFixture]
//
//public class GuiRendererTests
//{
// [Test]
// [Fact]
// public void GuiRenderer_TargetScreen_Test()
// {
// var screen = new GuiScreen();
@@ -1,85 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<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>{43CBA868-9BFC-4E02-8A7A-142C603B087E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MonoGame.Extended.Gui.Tests</RootNamespace>
<AssemblyName>MonoGame.Extended.Gui.Tests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</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>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<Reference Include="MonoGame.Framework, Version=3.6.0.1625, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\MonoGame.Framework.WindowsDX.3.6.0.1625\lib\net40\MonoGame.Framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NSubstitute, Version=1.10.0.0, Culture=neutral, PublicKeyToken=92dd2e9066daa5ca, processorArchitecture=MSIL">
<HintPath>..\..\packages\NSubstitute.1.10.0.0\lib\net45\NSubstitute.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.7.0.7" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controls\GuiControlCollectionTests.cs" />
<Compile Include="Controls\GuiButtonTests.cs" />
<Compile Include="GuiRendererTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<ProjectReference Include="..\..\MonoGame.Extended.Gui\MonoGame.Extended.Gui.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MonoGame.Extended.Gui\MonoGame.Extended.Gui.csproj">
<Project>{8e425575-378a-4f83-88c9-f8bebad227c9}</Project>
<Name>MonoGame.Extended.Gui</Name>
</ProjectReference>
<ProjectReference Include="..\..\MonoGame.Extended\MonoGame.Extended.csproj">
<Project>{41724c52-3d50-45bb-81eb-3c8a247eafd1}</Project>
<Name>MonoGame.Extended</Name>
</ProjectReference>
<ProjectReference Include="..\MonoGame.Extended.Tests\MonoGame.Extended.Tests.csproj">
<Project>{cef2144f-7e98-45a5-be08-e6dbc307a5c1}</Project>
<Name>MonoGame.Extended.Tests</Name>
</ProjectReference>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MonoGame.Extended.Gui.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MonoGame.Extended.Gui.Tests")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("43cba868-9bfc-4e02-8a7a-142c603b087e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MonoGame.Framework.WindowsDX" version="3.6.0.1625" targetFramework="net452" />
<package id="NSubstitute" version="1.10.0.0" targetFramework="net452" />
<package id="NUnit" version="2.6.4" targetFramework="net452" />
</packages>
@@ -1,14 +1,14 @@
//using Microsoft.Xna.Framework;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests
//{
// [TestFixture]
//
// public class AngleTest
// {
// private const float _delta = 0.00001f;
// [Test]
// [Fact]
// public void ConstructorTest()
// {
// const float value = 0.5f;
@@ -24,14 +24,14 @@
// Assert.That(0.5f, Is.EqualTo(revolutions.Revolutions).Within(_delta));
// }
// [Test]
// [Fact]
// public void ConversionTest()
// {
// //from radians
// var radians = new Angle(MathHelper.Pi);
// Assert.AreEqual(180f, radians.Degrees, _delta);
// Assert.AreEqual(200f, radians.Gradians, _delta);
// Assert.AreEqual(0.5f, radians.Revolutions, _delta);
// Assert.Equal(180f, radians.Degrees, _delta);
// Assert.Equal(200f, radians.Gradians, _delta);
// Assert.Equal(0.5f, radians.Revolutions, _delta);
// //to radians
// var degrees = new Angle(180f, AngleType.Degree);
// var gradians = new Angle(200f, AngleType.Gradian);
@@ -42,7 +42,7 @@
// Assert.That(MathHelper.Pi, Is.EqualTo(revolutions.Radians).Within(_delta));
// }
// [Test]
// [Fact]
// public void WrapTest()
// {
// for (var f = -10f; f < 10f; f += 0.1f)
@@ -61,23 +61,23 @@
// }
// }
// [Test]
// [Fact]
// public void VectorTest()
// {
// var angle = Angle.FromVector(Vector2.One);
// Assert.AreEqual(-MathHelper.Pi / 4d, angle.Radians, _delta);
// Assert.AreEqual(10f, angle.ToVector(10f).Length());
// Assert.Equal(-MathHelper.Pi / 4d, angle.Radians, _delta);
// Assert.Equal(10f, angle.ToVector(10f).Length());
// angle = Angle.FromVector(Vector2.UnitX);
// Assert.AreEqual(0, angle.Radians, _delta);
// Assert.Equal(0, angle.Radians, _delta);
// Assert.IsTrue(Vector2.UnitX.EqualsWithTolerence(angle.ToUnitVector()));
// angle = Angle.FromVector(-Vector2.UnitY);
// Assert.AreEqual(MathHelper.Pi / 2d, angle.Radians, _delta);
// Assert.Equal(MathHelper.Pi / 2d, angle.Radians, _delta);
// Assert.IsTrue((-Vector2.UnitY).EqualsWithTolerence(angle.ToUnitVector()));
// }
// [Test]
// [Fact]
// public void EqualsTest()
// {
// var angle1 = new Angle(0);
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MonoGame.Extended.BitmapFonts;
using MonoGame.Extended.TextureAtlases;
using Xunit;
@@ -60,9 +61,7 @@ namespace MonoGame.Extended.Tests.BitmapFonts
private static BitmapFont CreateTestFont()
{
var graphicsDevice = new TestGraphicsDevice();
var texture = new Texture2D(graphicsDevice, width: 256, height: 256);
var textureRegion = new TextureRegion2D(texture, x: 219, y: 61, width: 16, height: 18);
var textureRegion = new TextureRegion2D(null, x: 219, y: 61, width: 16, height: 18);
var regions = new[]
{
// extracted from 'Impact' font. 'x' is particularly interesting because it has a negative x offset
@@ -1,13 +1,13 @@
//using Microsoft.Xna.Framework;
//using MonoGame.Extended.ViewportAdapters;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests
//{
// [TestFixture]
//
// public class Camera2DTests
// {
// [Test]
// [Fact]
// public void Camera2D_LookAt_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
@@ -16,10 +16,10 @@
// camera.LookAt(new Vector2(100, 200));
// Assert.AreEqual(new Vector2(-300, -40), camera.Position);
// Assert.Equal(new Vector2(-300, -40), camera.Position);
// }
// [Test]
// [Fact]
// public void Camera2D_GetBoundingFrustum_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
@@ -38,7 +38,7 @@
// TestHelper.AreEqual(new Vector3(0, 480, 0), corners[7], delta);
// }
// [Test]
// [Fact]
// public void Camera2D_BoundingRectangle_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
@@ -49,49 +49,49 @@
// var boundingRectangle = camera.BoundingRectangle;
// Assert.AreEqual(2, boundingRectangle.Left, 0.01);
// Assert.AreEqual(3, boundingRectangle.Top, 0.01);
// Assert.AreEqual(802, boundingRectangle.Right, 0.01);
// Assert.AreEqual(483, boundingRectangle.Bottom, 0.01);
// Assert.Equal(2, boundingRectangle.Left, 0.01);
// Assert.Equal(3, boundingRectangle.Top, 0.01);
// Assert.Equal(802, boundingRectangle.Right, 0.01);
// Assert.Equal(483, boundingRectangle.Bottom, 0.01);
// }
// [Test]
// [Fact]
// public void Camera2D_ContainsPoint_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
// var camera = new OrthographicCamera(graphicsDevice);
// Assert.AreEqual(ContainmentType.Contains, camera.Contains(new Point(1, 1)));
// Assert.AreEqual(ContainmentType.Contains, camera.Contains(new Point(799, 479)));
// Assert.AreEqual(ContainmentType.Disjoint, camera.Contains(new Point(-1, -1)));
// Assert.AreEqual(ContainmentType.Disjoint, camera.Contains(new Point(801, 481)));
// Assert.Equal(ContainmentType.Contains, camera.Contains(new Point(1, 1)));
// Assert.Equal(ContainmentType.Contains, camera.Contains(new Point(799, 479)));
// Assert.Equal(ContainmentType.Disjoint, camera.Contains(new Point(-1, -1)));
// Assert.Equal(ContainmentType.Disjoint, camera.Contains(new Point(801, 481)));
// }
// [Test]
// [Fact]
// public void Camera2D_ContainsVector2_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
// var camera = new OrthographicCamera(graphicsDevice);
// Assert.AreEqual(ContainmentType.Contains, camera.Contains(new Vector2(799.5f, 479.5f)));
// Assert.AreEqual(ContainmentType.Contains, camera.Contains(new Vector2(0.5f, 0.5f)));
// Assert.AreEqual(ContainmentType.Disjoint, camera.Contains(new Vector2(-0.5f, -0.5f)));
// Assert.AreEqual(ContainmentType.Disjoint, camera.Contains(new Vector2(800.5f, 480.5f)));
// Assert.AreEqual(ContainmentType.Disjoint, camera.Contains(new Vector2(-0.5f, 240f)));
// Assert.AreEqual(ContainmentType.Contains, camera.Contains(new Vector2(0.5f, 240f)));
// Assert.AreEqual(ContainmentType.Contains, camera.Contains(new Vector2(799.5f, 240f)));
// Assert.AreEqual(ContainmentType.Disjoint, camera.Contains(new Vector2(800.5f, 240f)));
// Assert.Equal(ContainmentType.Contains, camera.Contains(new Vector2(799.5f, 479.5f)));
// Assert.Equal(ContainmentType.Contains, camera.Contains(new Vector2(0.5f, 0.5f)));
// Assert.Equal(ContainmentType.Disjoint, camera.Contains(new Vector2(-0.5f, -0.5f)));
// Assert.Equal(ContainmentType.Disjoint, camera.Contains(new Vector2(800.5f, 480.5f)));
// Assert.Equal(ContainmentType.Disjoint, camera.Contains(new Vector2(-0.5f, 240f)));
// Assert.Equal(ContainmentType.Contains, camera.Contains(new Vector2(0.5f, 240f)));
// Assert.Equal(ContainmentType.Contains, camera.Contains(new Vector2(799.5f, 240f)));
// Assert.Equal(ContainmentType.Disjoint, camera.Contains(new Vector2(800.5f, 240f)));
// }
// [Test]
// [Fact]
// public void Camera2D_ContainsRectangle_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
// var camera = new OrthographicCamera(graphicsDevice);
// Assert.AreEqual(ContainmentType.Intersects, camera.Contains(new Rectangle(-50, -50, 100, 100)));
// Assert.AreEqual(ContainmentType.Contains, camera.Contains(new Rectangle(50, 50, 100, 100)));
// Assert.AreEqual(ContainmentType.Disjoint, camera.Contains(new Rectangle(850, 500, 100, 100)));
// Assert.Equal(ContainmentType.Intersects, camera.Contains(new Rectangle(-50, -50, 100, 100)));
// Assert.Equal(ContainmentType.Contains, camera.Contains(new Rectangle(50, 50, 100, 100)));
// Assert.Equal(ContainmentType.Disjoint, camera.Contains(new Rectangle(850, 500, 100, 100)));
// }
// }
//}
@@ -19,10 +19,6 @@ namespace MonoGame.Extended.Tests.Collections
_random = new Random();
}
public void Dispose()
{
}
[Fact]
public void Deque_Constructor_Default()
{
@@ -5,8 +5,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.7.0.7" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
@@ -1,7 +1,7 @@
//using System;
//using MonoGame.Extended.Particles;
//using MonoGame.Extended.Particles.Modifiers;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Particles
//{
@@ -2,36 +2,36 @@
//using System.Globalization;
//using Microsoft.Xna.Framework;
//using MonoGame.Extended.Particles;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Particles
//{
// [TestFixture]
//
// public class ColourTests
// {
// public class Constructor
// {
// [Test]
// [Fact]
// public void WhenGivenValues_ReturnsInitializedColour()
// {
// var colour = new HslColor(1f, 1f, 1f);
// Assert.AreEqual(colour.H, 1f);
// Assert.AreEqual(colour.S, 1f);
// Assert.AreEqual(colour.L, 1f);
// Assert.Equal(colour.H, 1f);
// Assert.Equal(colour.S, 1f);
// Assert.Equal(colour.L, 1f);
// }
// }
// public class AreEqualColourMethod
// {
// [Test]
// [Fact]
// public void WhenGivenEqualValues_ReturnsTrue()
// {
// var x = new HslColor(360f, 1f, 1f);
// var y = new HslColor(360f, 1f, 1f);
// Assert.AreEqual(x, y);
// Assert.Equal(x, y);
// }
// [Test]
// [Fact]
// public void WhenGivenDifferentValues_ReturnsFalse()
// {
// var x = new HslColor(0f, 1f, 0f);
@@ -42,24 +42,24 @@
// public class AreEqualObjectMethod
// {
// [Test]
// [Fact]
// public void WhenGivenNull_ReturnsFalse()
// {
// var colour = new HslColor(360f, 1f, 1f);
// Assert.IsNotNull(colour);
// Assert.NotNull(colour);
// }
// [Test]
// [Fact]
// public void WhenGivenEqualColour_ReturnsTrue()
// {
// var x = new HslColor(360f, 1f, 1f);
// Object y = new HslColor(360f, 1f, 1f);
// Assert.AreEqual(x, y);
// Assert.Equal(x, y);
// }
// [Test]
// [Fact]
// public void WhenGivenDifferentColour_ReturnsFalse()
// {
@@ -69,7 +69,7 @@
// Assert.IsFalse(x.Equals(y));
// }
// [Test]
// [Fact]
// public void WhenGivenObjectOfAntotherType_ReturnsFalse()
// {
@@ -82,7 +82,7 @@
// public class GetHashCodeMethod
// {
// [Test]
// [Fact]
// public void WhenObjectsAreDifferent_YieldsDifferentHashCodes()
// {
@@ -91,13 +91,13 @@
// Assert.AreNotEqual(x.GetHashCode(), y.GetHashCode());
// }
// [Test]
// [Fact]
// public void WhenObjectsAreSame_YieldsIdenticalHashCodes()
// {
// var x = new HslColor(180f, 0.5f, 0.5f);
// var y = new HslColor(180f, 0.5f, 0.5f);
// Assert.AreEqual(x.GetHashCode(), y.GetHashCode());
// Assert.Equal(x.GetHashCode(), y.GetHashCode());
// }
// }
@@ -110,7 +110,7 @@
// public void ReturnsCorrectValue(float h, float s, float l, string expected)
// {
// var colour = new HslColor(h, s, l);
// Assert.AreEqual(expected, colour.ToString());
// Assert.Equal(expected, colour.ToString());
// }
// }
@@ -124,16 +124,16 @@
// var hslColour = new HslColor(h, s, l);
// Color rgbColor = hslColour.ToRgb();
// Assert.AreEqual(expected, rgbColor.ToString());
// Assert.Equal(expected, rgbColor.ToString());
// }
// [Test]
// [Fact]
// public void FromRgbAndToRgbWorksCorrectly()
// {
// HslColor blueHsl = HslColor.FromRgb(Color.Blue);
// Color blueRgb = blueHsl.ToRgb();
// Assert.AreEqual(Color.Blue, blueRgb);
// Assert.Equal(Color.Blue, blueRgb);
// }
// }
// }
@@ -3,16 +3,16 @@
//using MonoGame.Extended.Particles;
//using MonoGame.Extended.Particles.Modifiers;
//using MonoGame.Extended.Particles.Profiles;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Particles
//{
// [TestFixture]
//
// public class EmitterTests
// {
// public class UpdateMethod
// {
// [Test]
// [Fact]
// public void WhenThereAreParticlesToExpire_DecreasesActiveParticleCount()
// {
// var subject = new ParticleEmitter(null, 100, TimeSpan.FromSeconds(1), Profile.Point())
@@ -25,13 +25,13 @@
// };
// subject.Trigger(new Vector2(0f, 0f));
// Assert.AreEqual(subject.ActiveParticles, 1);
// Assert.Equal(subject.ActiveParticles, 1);
// subject.Update(2f);
// Assert.AreEqual(subject.ActiveParticles, 0);
// Assert.Equal(subject.ActiveParticles, 0);
// }
// [Test]
// [Fact]
// public void WhenThereAreParticlesToExpire_DoesNotPassExpiredParticlesToModifiers()
// {
// var subject = new ParticleEmitter(null, 100, TimeSpan.FromSeconds(1), Profile.Point())
@@ -54,19 +54,19 @@
// subject.Update(0.5f);
// }
// [Test]
// [Fact]
// public void WhenThereAreNoActiveParticles_GracefullyDoesNothing()
// {
// var subject = new ParticleEmitter(null, 100, TimeSpan.FromSeconds(1), Profile.Point()) { AutoTrigger = false };
// subject.Update(0.5f);
// Assert.AreEqual(subject.ActiveParticles, 0);
// Assert.Equal(subject.ActiveParticles, 0);
// }
// }
// public class TriggerMethod
// {
// [Test]
// [Fact]
// public void WhenEnoughHeadroom_IncreasesActiveParticlesCountByReleaseQuantity()
// {
// var subject = new ParticleEmitter(null, 100, TimeSpan.FromSeconds(1), Profile.Point())
@@ -76,12 +76,12 @@
// Quantity = 10
// }
// };
// Assert.AreEqual(subject.ActiveParticles, 0);
// Assert.Equal(subject.ActiveParticles, 0);
// subject.Trigger(new Vector2(0f, 0f));
// Assert.AreEqual(subject.ActiveParticles, 10);
// Assert.Equal(subject.ActiveParticles, 10);
// }
// [Test]
// [Fact]
// public void WhenNotEnoughHeadroom_IncreasesActiveParticlesCountByRemainingParticles()
// {
// var subject = new ParticleEmitter(null, 15, TimeSpan.FromSeconds(1), Profile.Point())
@@ -93,12 +93,12 @@
// };
// subject.Trigger(new Vector2(0f, 0f));
// Assert.AreEqual(subject.ActiveParticles, 10);
// Assert.Equal(subject.ActiveParticles, 10);
// subject.Trigger(new Vector2(0f, 0f));
// Assert.AreEqual(subject.ActiveParticles, 15);
// Assert.Equal(subject.ActiveParticles, 15);
// }
// [Test]
// [Fact]
// public void WhenNoRemainingParticles_DoesNotIncreaseActiveParticlesCount()
// {
// var subject = new ParticleEmitter(null, 10, TimeSpan.FromSeconds(1), Profile.Point())
@@ -110,15 +110,15 @@
// };
// subject.Trigger(new Vector2(0f, 0f));
// Assert.AreEqual(subject.ActiveParticles, 10);
// Assert.Equal(subject.ActiveParticles, 10);
// subject.Trigger(new Vector2(0f, 0f));
// Assert.AreEqual(subject.ActiveParticles, 10);
// Assert.Equal(subject.ActiveParticles, 10);
// }
// }
// public class DisposeMethod
// {
// [Test]
// [Fact]
// public void IsIdempotent()
// {
// var subject = new ParticleEmitter(null, 10, TimeSpan.FromSeconds(1), Profile.Point());
@@ -1,112 +1,112 @@
//using System;
//using MonoGame.Extended.Particles;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Particles
//{
// [TestFixture]
//
// public class ParticleBufferTests
// {
// public class AvailableProperty
// {
// [Test]
// [Fact]
// public void WhenNoParticlesReleased_ReturnsBufferSize()
// {
// var subject = new ParticleBuffer(100);
// Assert.AreEqual(subject.Available, 100);
// Assert.Equal(subject.Available, 100);
// }
// [Test]
// [Fact]
// public void WhenSomeParticlesReleased_ReturnsAvailableCount()
// {
// var subject = new ParticleBuffer(100);
// subject.Release(10);
// Assert.AreEqual(subject.Available, 90);
// Assert.Equal(subject.Available, 90);
// }
// [Test]
// [Fact]
// public void WhenAllParticlesReleased_ReturnsZero()
// {
// var subject = new ParticleBuffer(100);
// subject.Release(100);
// Assert.AreEqual(subject.Available, 0);
// Assert.Equal(subject.Available, 0);
// }
// }
// public class CountProperty
// {
// [Test]
// [Fact]
// public void WhenNoParticlesReleased_ReturnsZero()
// {
// var subject = new ParticleBuffer(100);
// Assert.AreEqual(subject.Count, 0);
// Assert.Equal(subject.Count, 0);
// }
// [Test]
// [Fact]
// public void WhenSomeParticlesReleased_ReturnsCount()
// {
// var subject = new ParticleBuffer(100);
// subject.Release(10);
// Assert.AreEqual(subject.Count, 10);
// Assert.Equal(subject.Count, 10);
// }
// [Test]
// [Fact]
// public void WhenAllParticlesReleased_ReturnsZero()
// {
// var subject = new ParticleBuffer(100);
// subject.Release(100);
// Assert.AreEqual(subject.Count, 100);
// Assert.Equal(subject.Count, 100);
// }
// }
// public class ReleaseMethod
// {
// [Test]
// [Fact]
// public void WhenPassedReasonableQuantity_ReturnsNumberReleased()
// {
// var subject = new ParticleBuffer(100);
// var count = subject.Release(50);
// Assert.AreEqual(count.Total, 50);
// Assert.Equal(count.Total, 50);
// }
// [Test]
// [Fact]
// public void WhenPassedImpossibleQuantity_ReturnsNumberActuallyReleased()
// {
// var subject = new ParticleBuffer(100);
// var count = subject.Release(200);
// Assert.AreEqual(count.Total, 100);
// Assert.Equal(count.Total, 100);
// }
// }
// public class ReclaimMethod
// {
// [Test]
// [Fact]
// public void WhenPassedReasonableNumber_ReclaimsParticles()
// {
// var subject = new ParticleBuffer(100);
// subject.Release(100);
// Assert.AreEqual(subject.Count, 100);
// Assert.Equal(subject.Count, 100);
// subject.Reclaim(50);
// Assert.AreEqual(subject.Count, 50);
// Assert.Equal(subject.Count, 50);
// }
// }
// //public class CopyToMethod
// //{
// // [Test]
// // [Fact]
// // public void WhenBufferIsSequential_CopiesParticlesInOrder()
// // {
// // unsafe
@@ -128,18 +128,18 @@
// // subject.CopyTo((IntPtr)buffer);
// // }
// // Assert.AreEqual(destination[0].Age, 1f, 0.0001);
// // Assert.AreEqual(destination[1].Age, 1f, 0.0001);
// // Assert.AreEqual(destination[2].Age, 1f, 0.0001);
// // Assert.AreEqual(destination[3].Age, 1f, 0.0001);
// // Assert.AreEqual(destination[4].Age, 1f, 0.0001);
// // Assert.Equal(destination[0].Age, 1f, 0.0001);
// // Assert.Equal(destination[1].Age, 1f, 0.0001);
// // Assert.Equal(destination[2].Age, 1f, 0.0001);
// // Assert.Equal(destination[3].Age, 1f, 0.0001);
// // Assert.Equal(destination[4].Age, 1f, 0.0001);
// // }
// // }
// //}
// //public class CopyToReverseMethod
// //{
// // [Test]
// // [Fact]
// // public void WhenBufferIsSequential_CopiesParticlesInReverseOrder()
// // {
// // unsafe
@@ -161,18 +161,18 @@
// // subject.CopyToReverse((IntPtr)buffer);
// // }
// // Assert.AreEqual(destination[0].Age, 1f, 0.0001);
// // Assert.AreEqual(destination[1].Age, 1f, 0.0001);
// // Assert.AreEqual(destination[2].Age, 1f, 0.0001);
// // Assert.AreEqual(destination[3].Age, 1f, 0.0001);
// // Assert.AreEqual(destination[4].Age, 1f, 0.0001);
// // Assert.Equal(destination[0].Age, 1f, 0.0001);
// // Assert.Equal(destination[1].Age, 1f, 0.0001);
// // Assert.Equal(destination[2].Age, 1f, 0.0001);
// // Assert.Equal(destination[3].Age, 1f, 0.0001);
// // Assert.Equal(destination[4].Age, 1f, 0.0001);
// // }
// // }
// //}
// public class DisposeMethod
// {
// [Test]
// [Fact]
// public void IsIdempotent()
// {
// var subject = new ParticleBuffer(100);
@@ -1,14 +1,14 @@
//using System;
//using Microsoft.Xna.Framework;
//using MonoGame.Extended.Particles.Profiles;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Particles.Profiles
//{
// [TestFixture]
//
// public class PointProfileTests
// {
// [Test]
// [Fact]
// public void ReturnsZeroOffset()
// {
// var subject = new PointProfile();
@@ -16,11 +16,11 @@
// Vector2 offset, heading;
// subject.GetOffsetAndHeading(out offset, out heading);
// Assert.AreEqual(0f, offset.X);
// Assert.AreEqual(0f, offset.Y);
// Assert.Equal(0f, offset.X);
// Assert.Equal(0f, offset.Y);
// }
// [Test]
// [Fact]
// public void ReturnsHeadingAsUnitVector()
// {
// var subject = new PointProfile();
@@ -29,7 +29,7 @@
// subject.GetOffsetAndHeading(out offset, out heading);
// var length = Math.Sqrt(heading.X * heading.X + heading.Y * heading.Y);
// Assert.AreEqual(1f, length, 0.000001);
// Assert.Equal(1f, length, 0.000001);
// }
// }
@@ -1,14 +1,14 @@
//using System;
//using Microsoft.Xna.Framework;
//using MonoGame.Extended.Particles.Profiles;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Particles.Profiles
//{
// [TestFixture]
//
// public class RingProfileTests
// {
// [Test]
// [Fact]
// public void ReturnsOffsetEqualToRadius()
// {
// var subject = new RingProfile
@@ -19,10 +19,10 @@
// subject.GetOffsetAndHeading(out offset, out heading);
// var length = Math.Sqrt(offset.X * offset.X + offset.Y * offset.Y);
// Assert.AreEqual(10f, length, 0.000001);
// Assert.Equal(10f, length, 0.000001);
// }
// [Test]
// [Fact]
// public void WhenRadiateIsTrue_HeadingIsEqualToNormalizedOffset()
// {
// var subject = new RingProfile
@@ -33,8 +33,8 @@
// Vector2 offset, heading;
// subject.GetOffsetAndHeading(out offset, out heading);
// Assert.AreEqual(heading.X, offset.X / 10, 0.000001);
// Assert.AreEqual(heading.Y, offset.Y / 10, 0.000001);
// Assert.Equal(heading.X, offset.X / 10, 0.000001);
// Assert.Equal(heading.Y, offset.Y / 10, 0.000001);
// }
@@ -1,11 +1,11 @@
//using System.Collections.Generic;
//using System.Globalization;
//using Microsoft.Xna.Framework;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Primitives
//{
// [TestFixture]
//
// public class BoundingRectangleTests
// {
// public IEnumerable<TestCaseData> ConstructorTestCases
@@ -21,13 +21,13 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ConstructorTestCases))]
// public void Constructor(Point2 centre, Vector2 radii)
// {
// var boundingRectangle = new BoundingRectangle(centre, radii);
// Assert.AreEqual(centre, boundingRectangle.Center);
// Assert.AreEqual(radii, boundingRectangle.HalfExtents);
// Assert.Equal(centre, boundingRectangle.Center);
// Assert.Equal(radii, boundingRectangle.HalfExtents);
// }
// public IEnumerable<TestCaseData> CreateFromMinimumMaximumTestCases
@@ -46,12 +46,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(CreateFromMinimumMaximumTestCases))]
// public void CreateFromMinimumMaximum(Point2 minimum, Point2 maximum, BoundingRectangle expectedBoundingRectangle)
// {
// var actualBoundingRectangle = BoundingRectangle.CreateFrom(minimum, maximum);
// Assert.AreEqual(expectedBoundingRectangle, actualBoundingRectangle);
// Assert.Equal(expectedBoundingRectangle, actualBoundingRectangle);
// }
// public IEnumerable<TestCaseData> CreateFromPointsTestCases
@@ -75,12 +75,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(CreateFromPointsTestCases))]
// public void CreateFromPoints(Point2[] points, BoundingRectangle expectedBoundingRectangle)
// {
// var actualBoundingRectangle = BoundingRectangle.CreateFrom(points);
// Assert.AreEqual(expectedBoundingRectangle, actualBoundingRectangle);
// Assert.Equal(expectedBoundingRectangle, actualBoundingRectangle);
// }
// public IEnumerable<TestCaseData> CreateFromTransformedTestCases
@@ -98,13 +98,13 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(CreateFromTransformedTestCases))]
// public void CreateFromTransformed(BoundingRectangle boundingRectangle, Matrix2 transformMatrix,
// BoundingRectangle expectedBoundingRectangle)
// {
// var actualBoundingRectangle = BoundingRectangle.Transform(boundingRectangle, ref transformMatrix);
// Assert.AreEqual(expectedBoundingRectangle, actualBoundingRectangle);
// Assert.Equal(expectedBoundingRectangle, actualBoundingRectangle);
// }
// public IEnumerable<TestCaseData> UnionTestCases
@@ -122,12 +122,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(UnionTestCases))]
// public void Union(BoundingRectangle boundingRectangle1, BoundingRectangle boundingRectangle2, BoundingRectangle expectedBoundingRectangle)
// {
// Assert.AreEqual(expectedBoundingRectangle, boundingRectangle1.Union(boundingRectangle2));
// Assert.AreEqual(expectedBoundingRectangle, BoundingRectangle.Union(boundingRectangle1, boundingRectangle2));
// Assert.Equal(expectedBoundingRectangle, boundingRectangle1.Union(boundingRectangle2));
// Assert.Equal(expectedBoundingRectangle, BoundingRectangle.Union(boundingRectangle1, boundingRectangle2));
// }
// public IEnumerable<TestCaseData> IntersectionTestCases
@@ -150,13 +150,13 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(IntersectionTestCases))]
// public void Intersection(BoundingRectangle boundingRectangle1, BoundingRectangle boundingRectangle2,
// BoundingRectangle? expectedBoundingRectangle)
// {
// Assert.AreEqual(expectedBoundingRectangle, boundingRectangle1.Intersection(boundingRectangle2));
// Assert.AreEqual(expectedBoundingRectangle, BoundingRectangle.Intersection(boundingRectangle1, boundingRectangle2));
// Assert.Equal(expectedBoundingRectangle, boundingRectangle1.Intersection(boundingRectangle2));
// Assert.Equal(expectedBoundingRectangle, BoundingRectangle.Intersection(boundingRectangle1, boundingRectangle2));
// }
// public IEnumerable<TestCaseData> IntersectsTestCases
@@ -177,12 +177,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(IntersectsTestCases))]
// public void Intersects(BoundingRectangle boundingRectangle1, BoundingRectangle boundingRectangle2, bool expectedToIntersect)
// {
// Assert.AreEqual(expectedToIntersect, boundingRectangle1.Intersects(boundingRectangle2));
// Assert.AreEqual(expectedToIntersect, BoundingRectangle.Intersects(boundingRectangle1, boundingRectangle2));
// Assert.Equal(expectedToIntersect, boundingRectangle1.Intersects(boundingRectangle2));
// Assert.Equal(expectedToIntersect, BoundingRectangle.Intersects(boundingRectangle1, boundingRectangle2));
// }
// public IEnumerable<TestCaseData> ContainsPointTestCases
@@ -203,12 +203,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ContainsPointTestCases))]
// public void ContainsPoint(BoundingRectangle boundingRectangle, Point2 point, bool expectedToContainPoint)
// {
// Assert.AreEqual(expectedToContainPoint, boundingRectangle.Contains(point));
// Assert.AreEqual(expectedToContainPoint, BoundingRectangle.Contains(boundingRectangle, point));
// Assert.Equal(expectedToContainPoint, boundingRectangle.Contains(point));
// Assert.Equal(expectedToContainPoint, BoundingRectangle.Contains(boundingRectangle, point));
// }
// public IEnumerable<TestCaseData> ClosestPointTestCases
@@ -231,12 +231,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ClosestPointTestCases))]
// public void ClosestPoint(BoundingRectangle boundingRectangle, Point2 point, Point2 expectedClosestPoint)
// {
// var actualClosestPoint = boundingRectangle.ClosestPointTo(point);
// Assert.AreEqual(expectedClosestPoint, actualClosestPoint);
// Assert.Equal(expectedClosestPoint, actualClosestPoint);
// }
// public IEnumerable<TestCaseData> EqualityTestCases
@@ -262,7 +262,7 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(EqualityTestCases))]
// public void Equality(BoundingRectangle boundingRectangle1, BoundingRectangle boundingRectangle2, bool expectedToBeEqual)
// {
@@ -272,7 +272,7 @@
// Assert.IsTrue(boundingRectangle1.Equals(boundingRectangle2) == expectedToBeEqual);
// if (expectedToBeEqual)
// Assert.AreEqual(boundingRectangle1.GetHashCode(), boundingRectangle2.GetHashCode());
// Assert.Equal(boundingRectangle1.GetHashCode(), boundingRectangle2.GetHashCode());
// }
// public IEnumerable<TestCaseData> InequalityTestCases
@@ -288,7 +288,7 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(InequalityTestCases))]
// public void Inequality(BoundingRectangle boundingRectangle, object obj, bool expectedToBeEqual)
// {
@@ -313,14 +313,14 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(HashCodeTestCases))]
// public void HashCode(BoundingRectangle boundingRectangle1, BoundingRectangle boundingRectangle2, bool expectedThatHashCodesAreEqual)
// {
// var hashCode1 = boundingRectangle1.GetHashCode();
// var hashCode2 = boundingRectangle2.GetHashCode();
// if (expectedThatHashCodesAreEqual)
// Assert.AreEqual(hashCode1, hashCode2);
// Assert.Equal(hashCode1, hashCode2);
// else
// Assert.AreNotEqual(hashCode1, hashCode2);
// }
@@ -339,12 +339,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ToRectangleTestCases))]
// public void ToRectangle(BoundingRectangle boundingRectangle, Rectangle expectedRectangle)
// {
// var actualRectangle = (Rectangle)boundingRectangle;
// Assert.AreEqual(expectedRectangle, actualRectangle);
// Assert.Equal(expectedRectangle, actualRectangle);
// }
// public IEnumerable<TestCaseData> FromRectangleTestCases
@@ -361,12 +361,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(FromRectangleTestCases))]
// public void FromRectangle(Rectangle rectangle, BoundingRectangle expectedBoundingRectangle)
// {
// var actualBoundingRectangle = (BoundingRectangle)rectangle;
// Assert.AreEqual(expectedBoundingRectangle, actualBoundingRectangle);
// Assert.Equal(expectedBoundingRectangle, actualBoundingRectangle);
// }
// public IEnumerable<TestCaseData> StringCases
@@ -385,12 +385,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(StringCases))]
// public void String(BoundingRectangle boundingRectangle, string expectedString)
// {
// var actualString = boundingRectangle.ToString();
// Assert.AreEqual(expectedString, actualString);
// Assert.Equal(expectedString, actualString);
// }
// }
//}
@@ -2,11 +2,11 @@
//using System.Collections.Generic;
//using System.Globalization;
//using Microsoft.Xna.Framework;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Primitives
//{
// [TestFixture]
//
// public class CircleFTests
// {
// public IEnumerable<TestCaseData> ConstructorTestCases
@@ -22,13 +22,13 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ConstructorTestCases))]
// public void Constructor(Point2 centre, float radius)
// {
// var circle = new CircleF(centre, radius);
// Assert.AreEqual(centre, circle.Center);
// Assert.AreEqual(radius, circle.Radius);
// Assert.Equal(centre, circle.Center);
// Assert.Equal(radius, circle.Radius);
// }
// public IEnumerable<TestCaseData> CreateFromMinimumMaximumTestCases
@@ -47,12 +47,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(CreateFromMinimumMaximumTestCases))]
// public void CreateFromMinimumMaximum(Point2 minimum, Point2 maximum, CircleF expectedBoundingCircle)
// {
// var actualBoundingCircle = CircleF.CreateFrom(minimum, maximum);
// Assert.AreEqual(expectedBoundingCircle, actualBoundingCircle);
// Assert.Equal(expectedBoundingCircle, actualBoundingCircle);
// }
// public IEnumerable<TestCaseData> CreateFromPointsTestCases
@@ -76,12 +76,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(CreateFromPointsTestCases))]
// public void CreateFromPoints(Point2[] points, CircleF expectedCircle)
// {
// var actualCircle = CircleF.CreateFrom(points);
// Assert.AreEqual(expectedCircle, actualCircle);
// Assert.Equal(expectedCircle, actualCircle);
// }
// public IEnumerable<TestCaseData> IntersectsCircleTestCases
@@ -102,12 +102,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(IntersectsCircleTestCases))]
// public void Intersects(CircleF circle, CircleF circle2, bool expectedToIntersect)
// {
// Assert.AreEqual(expectedToIntersect, circle.Intersects(circle2));
// Assert.AreEqual(expectedToIntersect, CircleF.Intersects(circle, circle2));
// Assert.Equal(expectedToIntersect, circle.Intersects(circle2));
// Assert.Equal(expectedToIntersect, CircleF.Intersects(circle, circle2));
// }
// public IEnumerable<TestCaseData> IntersectsRectangleTestCases
@@ -128,12 +128,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(IntersectsRectangleTestCases))]
// public void Intersects(CircleF circle, RectangleF rectangle, bool expectedToIntersect)
// {
// Assert.AreEqual(expectedToIntersect, circle.Intersects((BoundingRectangle)rectangle));
// Assert.AreEqual(expectedToIntersect, CircleF.Intersects(circle, (BoundingRectangle)rectangle));
// Assert.Equal(expectedToIntersect, circle.Intersects((BoundingRectangle)rectangle));
// Assert.Equal(expectedToIntersect, CircleF.Intersects(circle, (BoundingRectangle)rectangle));
// }
// public IEnumerable<TestCaseData> ContainsPointTestCases
@@ -154,12 +154,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ContainsPointTestCases))]
// public void ContainsPoint(CircleF circle, Point2 point, bool expectedToContainPoint)
// {
// Assert.AreEqual(expectedToContainPoint, circle.Contains(point));
// Assert.AreEqual(expectedToContainPoint, CircleF.Contains(circle, point));
// Assert.Equal(expectedToContainPoint, circle.Contains(point));
// Assert.Equal(expectedToContainPoint, CircleF.Contains(circle, point));
// }
// public IEnumerable<TestCaseData> ClosestPointTestCases
@@ -182,12 +182,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ClosestPointTestCases))]
// public void ClosestPoint(CircleF circle, Point2 point, Point2 expectedClosestPoint)
// {
// var actualClosestPoint = circle.ClosestPointTo(point);
// Assert.AreEqual(expectedClosestPoint, actualClosestPoint);
// Assert.Equal(expectedClosestPoint, actualClosestPoint);
// }
// public IEnumerable<TestCaseData> BoundaryPointTestCases
@@ -204,7 +204,7 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(BoundaryPointTestCases))]
// public void BoundaryPointAt(CircleF circle, float angle, Point2 expectedPoint)
// {
@@ -233,7 +233,7 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(EqualityTestCases))]
// public void Equality(CircleF circle1, CircleF circle2, bool expectedToBeEqual)
// {
@@ -243,7 +243,7 @@
// Assert.IsTrue(circle1.Equals(circle2) == expectedToBeEqual);
// if (expectedToBeEqual)
// Assert.AreEqual(circle1.GetHashCode(), circle2.GetHashCode());
// Assert.Equal(circle1.GetHashCode(), circle2.GetHashCode());
// }
// public IEnumerable<TestCaseData> InequalityTestCases
@@ -259,7 +259,7 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(InequalityTestCases))]
// public void Inequality(CircleF circle, object obj, bool expectedToBeEqual)
// {
@@ -284,14 +284,14 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(HashCodeTestCases))]
// public void HashCode(CircleF circle1, CircleF circle2, bool expectedThatHashCodesAreEqual)
// {
// var hashCode1 = circle1.GetHashCode();
// var hashCode2 = circle2.GetHashCode();
// if (expectedThatHashCodesAreEqual)
// Assert.AreEqual(hashCode1, hashCode2);
// Assert.Equal(hashCode1, hashCode2);
// else
// Assert.AreNotEqual(hashCode1, hashCode2);
// }
@@ -310,12 +310,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ToRectangleTestCases))]
// public void ToRectangle(CircleF circle, Rectangle expectedRectangle)
// {
// var actualRectangle = (Rectangle)circle;
// Assert.AreEqual(expectedRectangle, actualRectangle);
// Assert.Equal(expectedRectangle, actualRectangle);
// }
// public IEnumerable<TestCaseData> ToRectangleFTestCases
@@ -332,12 +332,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ToRectangleFTestCases))]
// public void ToRectangleF(CircleF circle, RectangleF expectedRectangle)
// {
// var actualRectangle = (RectangleF)circle;
// Assert.AreEqual(expectedRectangle, actualRectangle);
// Assert.Equal(expectedRectangle, actualRectangle);
// }
// public IEnumerable<TestCaseData> FromRectangleTestCases
@@ -354,12 +354,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(FromRectangleTestCases))]
// public void FromRectangle(Rectangle rectangle, CircleF expectedCircle)
// {
// var actualCircle = (CircleF)rectangle;
// Assert.AreEqual(expectedCircle, actualCircle);
// Assert.Equal(expectedCircle, actualCircle);
// }
// public IEnumerable<TestCaseData> FromRectangleFTestCases
@@ -376,12 +376,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(FromRectangleFTestCases))]
// public void FromRectangleF(RectangleF rectangle, CircleF expectedCircle)
// {
// var actualCircle = (CircleF)rectangle;
// Assert.AreEqual(expectedCircle, actualCircle);
// Assert.Equal(expectedCircle, actualCircle);
// }
// public IEnumerable<TestCaseData> StringCases
@@ -400,12 +400,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(StringCases))]
// public void String(CircleF circle, string expectedString)
// {
// var actualString = circle.ToString();
// Assert.AreEqual(expectedString, actualString);
// Assert.Equal(expectedString, actualString);
// }
// }
//}
@@ -1,12 +1,12 @@
//using Microsoft.Xna.Framework;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Primitives
//{
// [TestFixture]
//
// public class EllipseFTest
// {
// [Test]
// [Fact]
// [TestCase(-1, -1, Result = false)]
// [TestCase(110, 300, Result = true)]
// [TestCase(200, 300, Result = true)]
@@ -19,7 +19,7 @@
// return ellipse.Contains(x, y);
// }
// [Test]
// [Fact]
// [TestCase(299, 400, Result = false)]
// [TestCase(501, 400, Result = false)]
// [TestCase(400, 199, Result = false)]
@@ -1,11 +1,11 @@
//using System.Collections.Generic;
//using System.Globalization;
//using Microsoft.Xna.Framework;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Primitives
//{
// [TestFixture]
//
// public class Point2Tests
// {
// public IEnumerable<TestCaseData> ConstructorTestCases
@@ -22,13 +22,13 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ConstructorTestCases))]
// public void Constructor(float x, float y)
// {
// var point = new Point2(x, y);
// Assert.AreEqual(x, point.X);
// Assert.AreEqual(y, point.Y);
// Assert.Equal(x, point.X);
// Assert.Equal(y, point.Y);
// }
// public IEnumerable<TestCaseData> CoordinatesTestCases
@@ -45,18 +45,18 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(CoordinatesTestCases))]
// public void Coordinates(Point2 point, float expectedX, float expecetedY)
// {
// Assert.AreEqual(expectedX, point.X);
// Assert.AreEqual(expecetedY, point.Y);
// Assert.Equal(expectedX, point.X);
// Assert.Equal(expecetedY, point.Y);
// point.X = 10;
// Assert.AreEqual(10, point.X);
// Assert.Equal(10, point.X);
// point.Y = -10.123f;
// Assert.AreEqual(-10.123f, point.Y);
// Assert.Equal(-10.123f, point.Y);
// }
// public IEnumerable<TestCaseData> VectorAdditionTestCases
@@ -72,12 +72,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(VectorAdditionTestCases))]
// public void VectorAddition(Point2 point, Vector2 vector, Point2 expectedPoint)
// {
// Assert.AreEqual(expectedPoint, point + vector);
// Assert.AreEqual(expectedPoint, Point2.Add(point, vector));
// Assert.Equal(expectedPoint, point + vector);
// Assert.Equal(expectedPoint, Point2.Add(point, vector));
// }
// public IEnumerable<TestCaseData> VectorSubtractionTestCases
@@ -93,12 +93,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(VectorSubtractionTestCases))]
// public void VectorSubtraction(Point2 point, Vector2 vector, Point2 expectedPoint)
// {
// Assert.AreEqual(expectedPoint, point - vector);
// Assert.AreEqual(expectedPoint, Point2.Subtract(point, vector));
// Assert.Equal(expectedPoint, point - vector);
// Assert.Equal(expectedPoint, Point2.Subtract(point, vector));
// }
@@ -115,12 +115,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(DisplacementTestCases))]
// public void Displacement(Point2 point1, Point2 point2, Vector2 expectedVector)
// {
// Assert.AreEqual(expectedVector, point2 - point1);
// Assert.AreEqual(expectedVector, Point2.Displacement(point2, point1));
// Assert.Equal(expectedVector, point2 - point1);
// Assert.Equal(expectedVector, Point2.Displacement(point2, point1));
// }
// public IEnumerable<TestCaseData> SizeAdditionTestCases
@@ -136,12 +136,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(SizeAdditionTestCases))]
// public void SizeAdditon(Point2 point, Size2 size, Point2 expectedPoint)
// {
// Assert.AreEqual(expectedPoint, point + size);
// Assert.AreEqual(expectedPoint, Point2.Add(point, size));
// Assert.Equal(expectedPoint, point + size);
// Assert.Equal(expectedPoint, Point2.Add(point, size));
// }
// public IEnumerable<TestCaseData> SizeSubtractionTestCases
@@ -157,12 +157,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(SizeSubtractionTestCases))]
// public void SizeSubtraction(Point2 point, Size2 size, Point2 expectedPoint)
// {
// Assert.AreEqual(expectedPoint, point - size);
// Assert.AreEqual(expectedPoint, Point2.Subtract(point, size));
// Assert.Equal(expectedPoint, point - size);
// Assert.Equal(expectedPoint, Point2.Subtract(point, size));
// }
// public IEnumerable<TestCaseData> MinimumTestCases
@@ -179,12 +179,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(MinimumTestCases))]
// public void Minimum(Point2 point1, Point2 point2, Point2 expectedPoint)
// {
// var actualPoint = Point2.Minimum(point1, point2);
// Assert.AreEqual(expectedPoint, actualPoint);
// Assert.Equal(expectedPoint, actualPoint);
// }
// public IEnumerable<TestCaseData> MaximumTestCases
@@ -201,12 +201,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(MaximumTestCases))]
// public void Maximum(Point2 point1, Point2 point2, Point2 expectedPoint)
// {
// var actualPoint = Point2.Maximum(point1, point2);
// Assert.AreEqual(expectedPoint, actualPoint);
// Assert.Equal(expectedPoint, actualPoint);
// }
// public IEnumerable<TestCaseData> EqualityTestCases
@@ -227,7 +227,7 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(EqualityTestCases))]
// public void Equality(Point2 point1, Point2 point2, bool expectedToBeEqual)
// {
@@ -237,7 +237,7 @@
// Assert.IsTrue(point1.Equals(point2) == expectedToBeEqual);
// if (expectedToBeEqual)
// Assert.AreEqual(point1.GetHashCode(), point2.GetHashCode());
// Assert.Equal(point1.GetHashCode(), point2.GetHashCode());
// }
// public IEnumerable<TestCaseData> InequalityTestCases
@@ -252,7 +252,7 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(InequalityTestCases))]
// public void Inequality(Point2 point, object obj, bool expectedToBeEqual)
// {
@@ -275,14 +275,14 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(HashCodeTestCases))]
// public void HashCode(Point2 point1, Point2 point2, bool expectedThatHashCodesAreEqual)
// {
// var hashCode1 = point1.GetHashCode();
// var hashCode2 = point2.GetHashCode();
// if (expectedThatHashCodesAreEqual)
// Assert.AreEqual(hashCode1, hashCode2);
// Assert.Equal(hashCode1, hashCode2);
// else
// Assert.AreNotEqual(hashCode1, hashCode2);
// }
@@ -301,12 +301,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ToVectorTestCases))]
// public void ToVector(Point2 point, Vector2 expectedVector)
// {
// var actualVector = (Vector2)point;
// Assert.AreEqual(expectedVector, actualVector);
// Assert.Equal(expectedVector, actualVector);
// }
// public IEnumerable<TestCaseData> FromVectorTestCases
@@ -323,12 +323,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(FromVectorTestCases))]
// public void FromVector(Vector2 vector, Point2 expectedPoint)
// {
// var actualPoint = (Point2)vector;
// Assert.AreEqual(expectedPoint, actualPoint);
// Assert.Equal(expectedPoint, actualPoint);
// }
// public IEnumerable<TestCaseData> StringCases
@@ -345,12 +345,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(StringCases))]
// public void String(Point2 point, string expectedString)
// {
// var actualString = point.ToString();
// Assert.AreEqual(expectedString, actualString);
// Assert.Equal(expectedString, actualString);
// }
// }
//}
@@ -1,11 +1,11 @@
//using System.Collections.Generic;
//using System.Globalization;
//using Microsoft.Xna.Framework;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Primitives
//{
// [TestFixture]
//
// public class Ray2Tests
// {
// public IEnumerable<TestCaseData> ConstructorTestCases
@@ -21,13 +21,13 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ConstructorTestCases))]
// public void Constructor(Point2 position, Vector2 direction)
// {
// var ray = new Ray2(position, direction);
// Assert.AreEqual(position, ray.Position);
// Assert.AreEqual(direction, ray.Direction);
// Assert.Equal(position, ray.Position);
// Assert.Equal(direction, ray.Direction);
// }
// public IEnumerable<TestCaseData> PositionDirectionTestCases
@@ -45,20 +45,20 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(PositionDirectionTestCases))]
// public void PositionDirection(Ray2 ray, Point2 expectedPosition, Vector2 expecetedDirection)
// {
// Assert.AreEqual(expectedPosition, ray.Position);
// Assert.AreEqual(expecetedDirection, ray.Direction);
// Assert.Equal(expectedPosition, ray.Position);
// Assert.Equal(expecetedDirection, ray.Direction);
// ray.Position.X = 10;
// ray.Position.Y = 10;
// Assert.AreEqual(new Point2(10, 10), ray.Position);
// Assert.Equal(new Point2(10, 10), ray.Position);
// ray.Direction.X = -10.123f;
// ray.Direction.Y = 10.123f;
// Assert.AreEqual(new Vector2(-10.123f, 10.123f), ray.Direction);
// Assert.Equal(new Vector2(-10.123f, 10.123f), ray.Direction);
// }
// public IEnumerable<TestCaseData> IntersectsBoundingRectangleTestCases
@@ -84,21 +84,21 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(IntersectsBoundingRectangleTestCases))]
// public void IntersectsBoundingRectangle(Ray2 ray, BoundingRectangle boundingRectangle, bool expectedResult,
// Point2 firstExpectedIntersectionPoint, Point2 secondExpectedIntersectionPoint)
// {
// float rayNearDistance, rayFarDistance;
// var actualResult = ray.Intersects(boundingRectangle, out rayNearDistance, out rayFarDistance);
// Assert.AreEqual(expectedResult, actualResult);
// Assert.Equal(expectedResult, actualResult);
// if (actualResult)
// {
// var firstActualIntersectionPoint = ray.Position + ray.Direction * rayNearDistance;
// Assert.AreEqual(firstExpectedIntersectionPoint, firstActualIntersectionPoint);
// Assert.Equal(firstExpectedIntersectionPoint, firstActualIntersectionPoint);
// var secondActualIntersectionPoint = ray.Position + ray.Direction * rayFarDistance;
// Assert.AreEqual(secondExpectedIntersectionPoint, secondActualIntersectionPoint);
// Assert.Equal(secondExpectedIntersectionPoint, secondActualIntersectionPoint);
// }
// else
// {
@@ -128,7 +128,7 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(EqualityTestCases))]
// public void Equality(Ray2 ray1, Ray2 ray2, bool expectedToBeEqual)
// {
@@ -138,7 +138,7 @@
// Assert.IsTrue(ray1.Equals(ray2) == expectedToBeEqual);
// if (expectedToBeEqual)
// Assert.AreEqual(ray1.GetHashCode(), ray2.GetHashCode());
// Assert.Equal(ray1.GetHashCode(), ray2.GetHashCode());
// }
// public IEnumerable<TestCaseData> InequalityTestCases
@@ -153,7 +153,7 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(InequalityTestCases))]
// public void Inequality(Ray2 ray, object obj, bool expectedToBeEqual)
// {
@@ -178,14 +178,14 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(HashCodeTestCases))]
// public void HashCode(Ray2 ray1, Ray2 ray2, bool expectedThatHashCodesAreEqual)
// {
// var hashCode1 = ray1.GetHashCode();
// var hashCode2 = ray2.GetHashCode();
// if (expectedThatHashCodesAreEqual)
// Assert.AreEqual(hashCode1, hashCode2);
// Assert.Equal(hashCode1, hashCode2);
// else
// Assert.AreNotEqual(hashCode1, hashCode2);
// }
@@ -206,12 +206,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(StringCases))]
// public void String(Ray2 ray, string expectedString)
// {
// var actualString = ray.ToString();
// Assert.AreEqual(expectedString, actualString);
// Assert.Equal(expectedString, actualString);
// }
// }
//}
@@ -1,12 +1,12 @@
//using Microsoft.Xna.Framework;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Primitives
//{
// [TestFixture]
//
// public class RectangleFTests
// {
// [Test]
// [Fact]
// public void RectangleF_Intersects_Test()
// {
// var rect1 = new RectangleF(0, 0, 32, 32);
@@ -15,7 +15,7 @@
// Assert.IsFalse(rect1.Intersects(rect2));
// }
// [Test]
// [Fact]
// public void Rectangle_Intersects_Test()
// {
// var rect1 = new Rectangle(0, 0, 32, 32);
@@ -24,22 +24,22 @@
// Assert.IsFalse(rect1.Intersects(rect2));
// }
// [Test]
// [Fact]
// public void PassVector2AsConstructorParameter_Test()
// {
// var rect1 = new RectangleF(new Vector2(0, 0), new Size2(12.34f, 56.78f));
// var rect2 = new RectangleF(new Vector2(0, 0), new Vector2(12.34f, 56.78f));
// Assert.AreEqual(rect1, rect2);
// Assert.Equal(rect1, rect2);
// }
// [Test]
// [Fact]
// public void PassPointAsConstructorParameter_Test()
// {
// var rect1 = new RectangleF(new Vector2(0, 0), new Size2(12, 56));
// var rect2 = new RectangleF(new Vector2(0, 0), new Size2(12, 56));
// Assert.AreEqual(rect1, rect2);
// Assert.Equal(rect1, rect2);
// }
// }
//}
@@ -1,6 +1,6 @@
//using System.Collections.Generic;
//using System.Globalization;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Primitives
//{
@@ -21,13 +21,13 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ConstructorTestCases))]
// public void Constructor(Point2 startingPoint, Point2 endingPoint)
// {
// var segment = new Segment2(startingPoint, endingPoint);
// Assert.AreEqual(startingPoint, segment.Start);
// Assert.AreEqual(endingPoint, segment.End);
// Assert.Equal(startingPoint, segment.Start);
// Assert.Equal(endingPoint, segment.End);
// }
// public IEnumerable<TestCaseData> ClosestPointTestCases
@@ -55,12 +55,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ClosestPointTestCases))]
// public void ClosestPoint(Segment2 segment, Point2 point, Point2 expectedClosestPoint)
// {
// var actualClosestPoint = segment.ClosestPointTo(point);
// Assert.AreEqual(expectedClosestPoint, actualClosestPoint);
// Assert.Equal(expectedClosestPoint, actualClosestPoint);
// }
// public IEnumerable<TestCaseData> SquaredDistanceToPointTestCases
@@ -88,13 +88,13 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(SquaredDistanceToPointTestCases))]
// public void SquaredDistanceToPoint(Segment2 segment, Point2 point,
// float expectedDistance)
// {
// var actualDistance = segment.SquaredDistanceTo(point);
// Assert.AreEqual(expectedDistance, actualDistance);
// Assert.Equal(expectedDistance, actualDistance);
// }
// public IEnumerable<TestCaseData> IntersectsBoundingRectangleTestCases
@@ -120,18 +120,18 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(IntersectsBoundingRectangleTestCases))]
// public void IntersectsBoundingRectangle(Segment2 segment, BoundingRectangle boundingRectangle, bool expectedResult,
// Point2 expectedIntersectionPoint)
// {
// Point2 actualIntersectionPoint;
// var actualResult = segment.Intersects(boundingRectangle, out actualIntersectionPoint);
// Assert.AreEqual(expectedResult, actualResult);
// Assert.Equal(expectedResult, actualResult);
// if (actualResult)
// {
// Assert.AreEqual(expectedIntersectionPoint, actualIntersectionPoint);
// Assert.Equal(expectedIntersectionPoint, actualIntersectionPoint);
// }
// else
// {
@@ -162,7 +162,7 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(EqualityTestCases))]
// public void Equality(Segment2 segment1, Segment2 segment2, bool expectedToBeEqual)
// {
@@ -172,7 +172,7 @@
// Assert.IsTrue(segment1.Equals(segment2) == expectedToBeEqual);
// if (expectedToBeEqual)
// Assert.AreEqual(segment1.GetHashCode(), segment2.GetHashCode());
// Assert.Equal(segment1.GetHashCode(), segment2.GetHashCode());
// }
// public IEnumerable<TestCaseData> InequalityTestCases
@@ -187,7 +187,7 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(InequalityTestCases))]
// public void Inequality(Segment2 segment, object obj, bool expectedToBeEqual)
// {
@@ -212,14 +212,14 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(HashCodeTestCases))]
// public void HashCode(Segment2 segment1, Segment2 segment2, bool expectedThatHashCodesAreEqual)
// {
// var hashCode1 = segment1.GetHashCode();
// var hashCode2 = segment2.GetHashCode();
// if (expectedThatHashCodesAreEqual)
// Assert.AreEqual(hashCode1, hashCode2);
// Assert.Equal(hashCode1, hashCode2);
// else
// Assert.AreNotEqual(hashCode1, hashCode2);
// }
@@ -240,12 +240,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(StringCases))]
// public void String(Segment2 segment, string expectedString)
// {
// var actualString = segment.ToString();
// Assert.AreEqual(expectedString, actualString);
// Assert.Equal(expectedString, actualString);
// }
// }
//}
@@ -1,11 +1,11 @@
//using System.Collections.Generic;
//using System.Globalization;
//using Microsoft.Xna.Framework;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Primitives
//{
// [TestFixture]
//
// public class Size2Tests
// {
// public IEnumerable<TestCaseData> ConstructorTestCases
@@ -22,13 +22,13 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ConstructorTestCases))]
// public void Constructor(float width, float height)
// {
// var size = new Size2(width, height);
// Assert.AreEqual(width, size.Width);
// Assert.AreEqual(height, size.Height);
// Assert.Equal(width, size.Width);
// Assert.Equal(height, size.Height);
// }
// public IEnumerable<TestCaseData> DimensionsTestCases
@@ -45,18 +45,18 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(DimensionsTestCases))]
// public void Dimensions(Size2 size, float expectedWidth, float expecetedHeight)
// {
// Assert.AreEqual(expectedWidth, size.Width);
// Assert.AreEqual(expecetedHeight, size.Height);
// Assert.Equal(expectedWidth, size.Width);
// Assert.Equal(expecetedHeight, size.Height);
// size.Width = 10;
// Assert.AreEqual(10, size.Width);
// Assert.Equal(10, size.Width);
// size.Height = -10.123f;
// Assert.AreEqual(-10.123f, size.Height);
// Assert.Equal(-10.123f, size.Height);
// }
// public IEnumerable<TestCaseData> AdditionTestCases
@@ -72,12 +72,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(AdditionTestCases))]
// public void Addition(Size2 size1, Size2 size2, Size2 expectedSize)
// {
// Assert.AreEqual(expectedSize, size1 + size2);
// Assert.AreEqual(expectedSize, Size2.Add(size1, size2));
// Assert.Equal(expectedSize, size1 + size2);
// Assert.Equal(expectedSize, Size2.Add(size1, size2));
// }
// public IEnumerable<TestCaseData> SubtractionTestCases
@@ -93,12 +93,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(SubtractionTestCases))]
// public void Subtraction(Size2 size1, Size2 size2, Size2 expectedSize)
// {
// Assert.AreEqual(expectedSize, size1 - size2);
// Assert.AreEqual(expectedSize, Size2.Subtract(size1, size2));
// Assert.Equal(expectedSize, size1 - size2);
// Assert.Equal(expectedSize, Size2.Subtract(size1, size2));
// }
// public IEnumerable<TestCaseData> EqualityTestCases
@@ -119,7 +119,7 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(EqualityTestCases))]
// public void Equality(Size2 size1, Size2 size2, bool expectedToBeEqual)
// {
@@ -129,7 +129,7 @@
// Assert.IsTrue(size1.Equals(size2) == expectedToBeEqual);
// if (expectedToBeEqual)
// Assert.AreEqual(size1.GetHashCode(), size2.GetHashCode());
// Assert.Equal(size1.GetHashCode(), size2.GetHashCode());
// }
// public IEnumerable<TestCaseData> InequalityTestCases
@@ -144,7 +144,7 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(InequalityTestCases))]
// public void Inequality(Size2 size, object obj, bool expectedToBeEqual)
// {
@@ -167,14 +167,14 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(HashCodeTestCases))]
// public void HashCode(Size2 size1, Size2 size2, bool expectedThatHashCodesAreEqual)
// {
// var hashCode1 = size1.GetHashCode();
// var hashCode2 = size2.GetHashCode();
// if (expectedThatHashCodesAreEqual)
// Assert.AreEqual(hashCode1, hashCode2);
// Assert.Equal(hashCode1, hashCode2);
// else
// Assert.AreNotEqual(hashCode1, hashCode2);
// }
@@ -191,12 +191,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ToPointTestCases))]
// public void ToPoint(Size2 size, Point2 expectedPoint)
// {
// var actualPoint = (Point2)size;
// Assert.AreEqual(expectedPoint, actualPoint);
// Assert.Equal(expectedPoint, actualPoint);
// }
// public IEnumerable<TestCaseData> FromPointTestCases
@@ -211,12 +211,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(FromPointTestCases))]
// public void FromPoint(Point2 point, Size2 expectedSize)
// {
// var actualSize = (Size2)point;
// Assert.AreEqual(expectedSize, actualSize);
// Assert.Equal(expectedSize, actualSize);
// }
// public IEnumerable<TestCaseData> ToVectorTestCases
@@ -231,12 +231,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(ToVectorTestCases))]
// public void ToVector(Size2 size, Vector2 expectedVector)
// {
// var actualVector = (Vector2)size;
// Assert.AreEqual(expectedVector, actualVector);
// Assert.Equal(expectedVector, actualVector);
// }
// public IEnumerable<TestCaseData> FromVectorTestCases
@@ -251,12 +251,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(FromVectorTestCases))]
// public void FromVector(Vector2 vector, Size2 expectedSize)
// {
// var actualSize = (Size2)vector;
// Assert.AreEqual(expectedSize, actualSize);
// Assert.Equal(expectedSize, actualSize);
// }
// //public IEnumerable<TestCaseData> FromSizeTestCases
@@ -271,12 +271,12 @@
// // }
// //}
// //[Test]
// //[Fact]
// //[TestCaseSource(nameof(FromSizeTestCases))]
// //public void FromSize(Size2 size, Size2 expectedSize)
// //{
// // var actualSize = (Size2)size;
// // Assert.AreEqual(expectedSize, actualSize);
// // Assert.Equal(expectedSize, actualSize);
// //}
// public IEnumerable<TestCaseData> StringCases
@@ -293,12 +293,12 @@
// }
// }
// [Test]
// [Fact]
// [TestCaseSource(nameof(StringCases))]
// public void String(Size2 size, string expectedString)
// {
// var actualString = size.ToString();
// Assert.AreEqual(expectedString, actualString);
// Assert.Equal(expectedString, actualString);
// }
// }
//}
@@ -1,12 +1,12 @@
//using System;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests
//{
// [TestFixture]
//
// public class RangeTests
// {
// [Test]
// [Fact]
// public void ConstructorTest()
// {
// //can pass min < max
@@ -17,7 +17,7 @@
// Assert.DoesNotThrow(() => new Range<int>(10, 10));
// }
// [Test]
// [Fact]
// public void DegenerateTest()
// {
// var proper = new Range<double>(0, 1);
@@ -29,13 +29,13 @@
// Assert.IsTrue(degenerate.IsDegenerate);
// }
// [Test]
// [Fact]
// public void IntegerTest()
// {
// var range = new Range<int>(10, 100);
// Assert.AreEqual(range.Min, 10);
// Assert.AreEqual(range.Max, 100);
// Assert.Equal(range.Min, 10);
// Assert.Equal(range.Max, 100);
// for (var i = 10; i <= 100; i++)
// {
@@ -48,13 +48,13 @@
// Assert.IsFalse(range.IsInBetween(100, maxValueExclusive: true));
// }
// [Test]
// [Fact]
// public void FloatTest()
// {
// var range = new Range<float>(0f, 1f);
// Assert.AreEqual(range.Min, 0f);
// Assert.AreEqual(range.Max, 1f);
// Assert.Equal(range.Min, 0f);
// Assert.Equal(range.Max, 1f);
// for (float i = 0; i <= 1f; i += 0.001f)
// {
@@ -68,7 +68,7 @@
// Assert.IsFalse(range.IsInBetween(1f, maxValueExclusive: true));
// }
// [Test]
// [Fact]
// public void OperatorTest()
// {
// var rangeA = new Range<int>(0, 1);
@@ -87,16 +87,16 @@
// Assert.IsFalse(rangeA.Equals(rangeD));
// Range<int> implict = 1;
// Assert.AreEqual(implict.Max, 1);
// Assert.AreEqual(implict.Min, 1);
// Assert.Equal(implict.Max, 1);
// Assert.Equal(implict.Min, 1);
// }
// [Test]
// [Fact]
// public void ToStringTest()
// {
// var range = new Range<float>(0, 1);
// Assert.AreEqual(range.ToString(), "Range<Single> [0 1]");
// Assert.Equal(range.ToString(), "Range<Single> [0 1]");
// }
// }
//}
@@ -1,13 +1,13 @@
//using Microsoft.Xna.Framework;
//using MonoGame.Extended.Shapes;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Shapes
//{
// [TestFixture]
//
// public class PolygonFTests
// {
// [Test]
// [Fact]
// public void Polygon_Contains_Point_Test()
// {
// var vertices = new[]
@@ -27,7 +27,7 @@
// Assert.IsFalse(polygon.Contains(new Vector2(-11f, -11f)));
// }
// [Test]
// [Fact]
// public void Polygon_Transform_Translation_Test()
// {
// var vertices = new[]
@@ -41,13 +41,13 @@
// var polygon = new Polygon(vertices);
// polygon.Offset(new Vector2(2, 3));
// Assert.AreEqual(new Vector2(2, 3), polygon.Vertices[0]);
// Assert.AreEqual(new Vector2(12, 3), polygon.Vertices[1]);
// Assert.AreEqual(new Vector2(12, 13), polygon.Vertices[2]);
// Assert.AreEqual(new Vector2(2, 13), polygon.Vertices[3]);
// Assert.Equal(new Vector2(2, 3), polygon.Vertices[0]);
// Assert.Equal(new Vector2(12, 3), polygon.Vertices[1]);
// Assert.Equal(new Vector2(12, 13), polygon.Vertices[2]);
// Assert.Equal(new Vector2(2, 13), polygon.Vertices[3]);
// }
// [Test]
// [Fact]
// public void Polygon_Transform_Rotation_Test()
// {
// var vertices = new[]
@@ -66,7 +66,7 @@
// Assert.IsTrue(new Vector2(-10, -5).EqualsWithTolerence(polygon.Vertices[2], tolerance));
// }
// [Test]
// [Fact]
// public void Polygon_Transform_Scale_Test()
// {
// var vertices = new[]
@@ -3,44 +3,44 @@
//using MonoGame.Extended.Sprites;
//using MonoGame.Extended.TextureAtlases;
//using NSubstitute;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Sprites
//{
// [TestFixture]
//
// public class SpriteTests
// {
// [Test]
// [Fact]
// public void Sprite_BoundingRectangleAfterPosition_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
// var texture = Substitute.For<Texture2D>(graphicsDevice, 50, 200);
// var sprite = new Sprite(texture);
// Assert.AreEqual(new RectangleF(375, 140, 50, 200), sprite.GetBoundingRectangle(new Vector2(400, 240), 0, Vector2.One));
// Assert.Equal(new RectangleF(375, 140, 50, 200), sprite.GetBoundingRectangle(new Vector2(400, 240), 0, Vector2.One));
// }
// [Test]
// [Fact]
// public void Sprite_BoundingRectangleAfterOrigin_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
// var texture = Substitute.For<Texture2D>(graphicsDevice, 50, 200);
// var sprite = new Sprite(texture) { OriginNormalized = new Vector2(1.0f, 1.0f) };
// Assert.AreEqual(new RectangleF(-50, -200, 50, 200), sprite.GetBoundingRectangle(Vector2.Zero, 0, Vector2.One));
// Assert.Equal(new RectangleF(-50, -200, 50, 200), sprite.GetBoundingRectangle(Vector2.Zero, 0, Vector2.One));
// }
// [Test]
// [Fact]
// public void Sprite_BoundingRectangleAfterScale_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
// var texture = Substitute.For<Texture2D>(graphicsDevice, 50, 200);
// var sprite = new Sprite(texture);
// Assert.AreEqual(new RectangleF(-50, -200, 100, 400), sprite.GetBoundingRectangle(Vector2.Zero, 0, Vector2.One * 2.0f));
// Assert.Equal(new RectangleF(-50, -200, 100, 400), sprite.GetBoundingRectangle(Vector2.Zero, 0, Vector2.One * 2.0f));
// }
// [Test]
// [Fact]
// public void Sprite_BoundingRectangleAfterRotation_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
@@ -50,28 +50,28 @@
// AssertExtensions.AreApproximatelyEqual(new RectangleF(-100, -25, 200, 50), sprite.GetBoundingRectangle(Vector2.Zero, MathHelper.ToRadians(90), Vector2.One * 2.0f));
// }
// [Test]
// [Fact]
// public void Sprite_TextureRegionIsFullTextureWhenTextureConstructorIsUsed_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
// var texture = Substitute.For<Texture2D>(graphicsDevice, 100, 200);
// var sprite = new Sprite(texture);
// Assert.AreEqual(new Rectangle(0, 0, 100, 200), sprite.TextureRegion.Bounds);
// Assert.Equal(new Rectangle(0, 0, 100, 200), sprite.TextureRegion.Bounds);
// }
// [Test]
// [Fact]
// public void Sprite_DefaultOriginIsCentre_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
// var texture = Substitute.For<Texture2D>(graphicsDevice, 100, 200);
// var sprite = new Sprite(texture);
// Assert.AreEqual(new Vector2(0.5f, 0.5f), sprite.OriginNormalized);
// Assert.AreEqual(new Vector2(50, 100), sprite.Origin);
// Assert.Equal(new Vector2(0.5f, 0.5f), sprite.OriginNormalized);
// Assert.Equal(new Vector2(50, 100), sprite.Origin);
// }
// [Test]
// [Fact]
// public void Sprite_PreserveNormalizedOriginWhenTextureRegionChanges_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
@@ -79,13 +79,13 @@
// var textureRegion = new TextureRegion2D(texture, 10, 20, 30, 40);
// var sprite = new Sprite(textureRegion);
// Assert.AreEqual(new Vector2(0.5f, 0.5f), sprite.OriginNormalized);
// Assert.AreEqual(new Vector2(15, 20), sprite.Origin);
// Assert.Equal(new Vector2(0.5f, 0.5f), sprite.OriginNormalized);
// Assert.Equal(new Vector2(15, 20), sprite.Origin);
// sprite.TextureRegion = new TextureRegion2D(texture, 30, 40, 50, 60);
// Assert.AreEqual(new Vector2(0.5f, 0.5f), sprite.OriginNormalized);
// Assert.AreEqual(new Vector2(25, 30), sprite.Origin);
// Assert.Equal(new Vector2(0.5f, 0.5f), sprite.OriginNormalized);
// Assert.Equal(new Vector2(25, 30), sprite.Origin);
// }
// }
//}
@@ -1,6 +1,6 @@
//using Microsoft.Xna.Framework;
//using Microsoft.Xna.Framework.Graphics;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests
//{
@@ -8,9 +8,9 @@
// {
// public static void AreEqual(Vector3 a, Vector3 b, double delta)
// {
// Assert.AreEqual(a.X, b.X, delta);
// Assert.AreEqual(a.Y, b.Y, delta);
// Assert.AreEqual(a.Z, b.Z, delta);
// Assert.Equal(a.X, b.X, delta);
// Assert.Equal(a.Y, b.Y, delta);
// Assert.Equal(a.Z, b.Z, delta);
// }
// public static GraphicsDevice CreateGraphicsDevice()
@@ -3,14 +3,14 @@
//using System.Linq;
//using Microsoft.Xna.Framework.Graphics;
//using MonoGame.Extended.TextureAtlases;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.TextureAtlases
//{
// [TestFixture]
//
// public class TextureAtlasTests
// {
// [Test]
// [Fact]
// public void TextureAtlas_CreateRegion_Test()
// {
// var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 100, 200);
@@ -19,13 +19,13 @@
// var region = atlas.CreateRegion("region0", 10, 20, 30, 40);
// Assert.AreSame(texture, region.Texture);
// Assert.AreEqual(10, region.X);
// Assert.AreEqual(20, region.Y);
// Assert.AreEqual(30, region.Width);
// Assert.AreEqual(40, region.Height);
// Assert.Equal(10, region.X);
// Assert.Equal(20, region.Y);
// Assert.Equal(30, region.Width);
// Assert.Equal(40, region.Height);
// }
// [Test]
// [Fact]
// public void TextureAtlas_GetRegionsByIndex_Test()
// {
// var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 100, 200);
@@ -41,7 +41,7 @@
// }
// [Test]
// [Fact]
// public void TextureAtlas_GetRegionsByName_Test()
// {
// var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 100, 200);
@@ -56,7 +56,7 @@
// Assert.AreSame(region1, atlas.GetRegion("region1"));
// }
// [Test]
// [Fact]
// public void TextureAtlas_RemoveRegions_Test()
// {
// var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 100, 200);
@@ -67,23 +67,23 @@
// var region2 = atlas.CreateRegion("region2", 32, 33, 34, 35);
// Assert.AreSame(texture, atlas.Texture);
// Assert.AreEqual(3, atlas.RegionCount);
// Assert.AreEqual(atlas.RegionCount, atlas.Regions.Count());
// Assert.Equal(3, atlas.RegionCount);
// Assert.Equal(atlas.RegionCount, atlas.Regions.Count());
// Assert.AreSame(region1, atlas[1]);
// atlas.RemoveRegion(1);
// Assert.AreEqual(2, atlas.Regions.Count());
// Assert.Equal(2, atlas.Regions.Count());
// Assert.AreSame(region0, atlas[0]);
// Assert.AreSame(region2, atlas[1]);
// atlas.RemoveRegion("region0");
// Assert.AreEqual(1, atlas.Regions.Count());
// Assert.Equal(1, atlas.Regions.Count());
// Assert.AreSame(region2, atlas[0]);
// }
// [Test]
// [Fact]
// public void TextureAtlas_CreateRegionThatAlreadyExistsThrowsException_Test()
// {
// var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 100, 200);
@@ -93,7 +93,7 @@
// Assert.Throws<InvalidOperationException>(() => atlas.CreateRegion("region0", 50, 60, 35, 45));
// }
// [Test]
// [Fact]
// public void TextureAtlas_GetRegion_InvalidIndexThrowsException_Test()
// {
// var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 100, 200);
@@ -103,7 +103,7 @@
// Assert.Throws<IndexOutOfRangeException>(() => atlas.GetRegion(-1));
// }
// [Test]
// [Fact]
// public void TextureAtlas_GetRegion_InvalidNameThrowsException_Test()
// {
// var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 100, 200);
@@ -113,7 +113,7 @@
// Assert.Throws<KeyNotFoundException>(() => atlas.GetRegion("region1"));
// }
// [Test]
// [Fact]
// public void TextureAtlas_EnumerateRegions_Test()
// {
// var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 100, 200);
@@ -132,68 +132,68 @@
// }
// }
// [Test]
// [Fact]
// public void TextureAtlas_Create_WithDefaultParameters_Test()
// {
// var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 50, 100) {Name = "testTexture"};
// var atlas = TextureAtlas.Create(null, texture, 25, 50);
// Assert.AreEqual(4, atlas.RegionCount);
// Assert.Equal(4, atlas.RegionCount);
// Assert.IsTrue(atlas.Regions.All(i => i.Width == 25));
// Assert.IsTrue(atlas.Regions.All(i => i.Height == 50));
// Assert.IsTrue(atlas.Regions.All(i => ReferenceEquals(i.Texture, texture)));
// Assert.IsTrue(atlas.Regions.All(i => i.Name.StartsWith(texture.Name)));
// }
// [Test]
// [Fact]
// public void TextureAtlas_Create_WithMaxRegionCount_Test()
// {
// var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 64, 64);
// var atlas = TextureAtlas.Create(null, texture, 32, 32, maxRegionCount: 3);
// Assert.AreEqual(3, atlas.RegionCount);
// Assert.Equal(3, atlas.RegionCount);
// }
// [Test]
// [Fact]
// public void TextureAtlas_Create_WithMargin_Test()
// {
// var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 24, 24);
// var atlas = TextureAtlas.Create(null, texture, 10, 10, margin: 2);
// Assert.AreEqual(4, atlas.RegionCount);
// Assert.Equal(4, atlas.RegionCount);
// Assert.IsTrue(atlas.Regions.All(i => i.Width == 10 && i.Height == 10));
// Assert.AreEqual(atlas[0].X, 2);
// Assert.AreEqual(atlas[0].Y, 2);
// Assert.AreEqual(atlas[3].X, 12);
// Assert.AreEqual(atlas[3].Y, 12);
// Assert.Equal(atlas[0].X, 2);
// Assert.Equal(atlas[0].Y, 2);
// Assert.Equal(atlas[3].X, 12);
// Assert.Equal(atlas[3].Y, 12);
// }
// [Test]
// [Fact]
// public void TextureAtlas_Create_WithSpacing_Test()
// {
// var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 24, 24);
// var atlas = TextureAtlas.Create(null, texture, 10, 10, spacing: 2);
// Assert.AreEqual(4, atlas.RegionCount);
// Assert.Equal(4, atlas.RegionCount);
// Assert.IsTrue(atlas.Regions.All(i => i.Width == 10 && i.Height == 10));
// Assert.AreEqual(atlas[0].X, 0);
// Assert.AreEqual(atlas[0].Y, 0);
// Assert.AreEqual(atlas[3].X, 12);
// Assert.AreEqual(atlas[3].Y, 12);
// Assert.Equal(atlas[0].X, 0);
// Assert.Equal(atlas[0].Y, 0);
// Assert.Equal(atlas[3].X, 12);
// Assert.Equal(atlas[3].Y, 12);
// }
// [Test]
// [Fact]
// public void TextureAtlas_Create_WithMarginAndSpacing_Test()
// {
// var texture = new Texture2D(TestHelper.CreateGraphicsDevice(), 28, 28);
// var atlas = TextureAtlas.Create(null, texture, 10, 10, margin: 3, spacing: 2);
// Assert.AreEqual(4, atlas.RegionCount);
// Assert.Equal(4, atlas.RegionCount);
// Assert.IsTrue(atlas.Regions.All(i => i.Width == 10 && i.Height == 10));
// Assert.AreEqual(atlas[0].X, 3);
// Assert.AreEqual(atlas[0].Y, 3);
// Assert.AreEqual(atlas[3].X, 15);
// Assert.AreEqual(atlas[3].Y, 15);
// Assert.Equal(atlas[0].X, 3);
// Assert.Equal(atlas[0].Y, 3);
// Assert.Equal(atlas[3].X, 15);
// Assert.Equal(atlas[3].Y, 15);
// }
// }
//}
@@ -1,13 +1,13 @@
//using Microsoft.Xna.Framework.Graphics;
//using MonoGame.Extended.TextureAtlases;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.TextureAtlases
//{
// [TestFixture]
//
// public class TextureRegion2DTests
// {
// [Test]
// [Fact]
// public void TextureRegion2D_FromTexture_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
@@ -15,14 +15,14 @@
// var textureRegion = new TextureRegion2D(texture);
// Assert.AreSame(texture, textureRegion.Texture);
// Assert.AreEqual(0, textureRegion.X);
// Assert.AreEqual(0, textureRegion.Y);
// Assert.AreEqual(100, textureRegion.Width);
// Assert.AreEqual(200, textureRegion.Height);
// Assert.Equal(0, textureRegion.X);
// Assert.Equal(0, textureRegion.Y);
// Assert.Equal(100, textureRegion.Width);
// Assert.Equal(200, textureRegion.Height);
// Assert.IsNull(textureRegion.Tag);
// }
// [Test]
// [Fact]
// public void TextureRegion2D_Specified_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
@@ -30,10 +30,10 @@
// var textureRegion = new TextureRegion2D(texture, 10, 20, 30, 40);
// Assert.AreSame(texture, textureRegion.Texture);
// Assert.AreEqual(10, textureRegion.X);
// Assert.AreEqual(20, textureRegion.Y);
// Assert.AreEqual(30, textureRegion.Width);
// Assert.AreEqual(40, textureRegion.Height);
// Assert.Equal(10, textureRegion.X);
// Assert.Equal(20, textureRegion.Y);
// Assert.Equal(30, textureRegion.Width);
// Assert.Equal(40, textureRegion.Height);
// Assert.IsNull(textureRegion.Tag);
// }
// }
@@ -1,14 +1,14 @@
//using System;
//using System.Collections.Generic;
//using Microsoft.Xna.Framework;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests
//{
// [TestFixture]
//
// public class Vector2ExtensionsTests
// {
// [Test]
// [Fact]
// public void Vector2_EqualsWithTolerence_Test()
// {
// var a = new Vector2(1f, 1f);
@@ -18,7 +18,7 @@
// Assert.IsTrue(a.EqualsWithTolerence(b));
// }
// [Test]
// [Fact]
// public void Vector2_NormalizedCopy_Test()
// {
// var a = new Vector2(5, -10);
@@ -27,7 +27,7 @@
// Assert.IsTrue(new Vector2(0.4472136f, -0.8944272f).EqualsWithTolerence(b));
// }
// [Test]
// [Fact]
// public void Vector2_Perpendicular_Test()
// {
// // http://mathworld.wolfram.com/PerpendicularVector.html
@@ -35,11 +35,11 @@
// var b = a.PerpendicularClockwise();
// var c = a.PerpendicularCounterClockwise();
// Assert.AreEqual(new Vector2(-10, -5), b);
// Assert.AreEqual(new Vector2(10, 5), c);
// Assert.Equal(new Vector2(-10, -5), b);
// Assert.Equal(new Vector2(10, 5), c);
// }
// [Test]
// [Fact]
// public void Vector2_Rotate_90_Degrees_Test()
// {
// var a = new Vector2(0, -10);
@@ -48,7 +48,7 @@
// Assert.IsTrue(new Vector2(10, 0).EqualsWithTolerence(b));
// }
// [Test]
// [Fact]
// public void Vector2_Rotate_360_Degrees_Test()
// {
// var a = new Vector2(0, 10);
@@ -57,7 +57,7 @@
// Assert.IsTrue(new Vector2(0, 10).EqualsWithTolerence(b));
// }
// [Test]
// [Fact]
// public void Vector2_Rotate_45_Degrees_Test()
// {
// var a = new Vector2(0, -10);
@@ -66,16 +66,16 @@
// Assert.IsTrue(new Vector2(7.071068f, -7.071068f).EqualsWithTolerence(b));
// }
// [Test]
// [Fact]
// public void Vector2_Truncate_Test()
// {
// var a = new Vector2(10, 10);
// var b = a.Truncate(5);
// Assert.AreEqual(5f, b.Length(), 0.001f);
// Assert.Equal(5f, b.Length(), 0.001f);
// }
// [Test]
// [Fact]
// public void Vector2_IsNaN_Test()
// {
// var a = new Vector2(float.NaN, 10);
@@ -89,16 +89,16 @@
// Assert.IsFalse(d.IsNaN());
// }
// [Test]
// [Fact]
// public void Vector2_ToAngle_Test()
// {
// var a = new Vector2(0, -10);
// var b = new Vector2(10, 0);
// var c = -Vector2.UnitY.Rotate(MathHelper.ToRadians(45));
// Assert.AreEqual(MathHelper.ToRadians(0), a.ToAngle());
// Assert.AreEqual(MathHelper.ToRadians(90), b.ToAngle());
// Assert.AreEqual(MathHelper.ToRadians(45), c.ToAngle());
// Assert.Equal(MathHelper.ToRadians(0), a.ToAngle());
// Assert.Equal(MathHelper.ToRadians(90), b.ToAngle());
// Assert.Equal(MathHelper.ToRadians(45), c.ToAngle());
// }
// }
//}
@@ -1,13 +1,13 @@
//using Microsoft.Xna.Framework.Graphics;
//using MonoGame.Extended.ViewportAdapters;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.ViewportAdapters
//{
// [TestFixture]
//
// public class BoxingViewportAdapterTests
// {
// [Test]
// [Fact]
// public void BoxingViewportAdapter_Letterbox_Test()
// {
// var gameWindow = new MockGameWindow();
@@ -17,12 +17,12 @@
// graphicsDevice.Viewport = new Viewport(0, 0, 1024, 768);
// viewportAdapter.Reset();
// Assert.AreEqual(1024, graphicsDevice.Viewport.Width);
// Assert.AreEqual(614, graphicsDevice.Viewport.Height);
// Assert.AreEqual(BoxingMode.Letterbox, viewportAdapter.BoxingMode);
// Assert.Equal(1024, graphicsDevice.Viewport.Width);
// Assert.Equal(614, graphicsDevice.Viewport.Height);
// Assert.Equal(BoxingMode.Letterbox, viewportAdapter.BoxingMode);
// }
// [Test]
// [Fact]
// public void BoxingViewportAdapter_Pillarbox_Test()
// {
// var gameWindow = new MockGameWindow();
@@ -32,9 +32,9 @@
// graphicsDevice.Viewport = new Viewport(0, 0, 900, 500);
// viewportAdapter.Reset();
// Assert.AreEqual(833, graphicsDevice.Viewport.Width);
// Assert.AreEqual(500, graphicsDevice.Viewport.Height);
// Assert.AreEqual(BoxingMode.Pillarbox, viewportAdapter.BoxingMode);
// Assert.Equal(833, graphicsDevice.Viewport.Width);
// Assert.Equal(500, graphicsDevice.Viewport.Height);
// Assert.Equal(BoxingMode.Pillarbox, viewportAdapter.BoxingMode);
// }
// }
@@ -1,14 +1,14 @@
//using Microsoft.Xna.Framework;
//using Microsoft.Xna.Framework.Graphics;
//using MonoGame.Extended.ViewportAdapters;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.ViewportAdapters
//{
// [TestFixture]
//
// public class DefaultViewportAdapterTests
// {
// [Test]
// [Fact]
// public void DefaultViewportAdapter_Test()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
@@ -16,11 +16,11 @@
// graphicsDevice.Viewport = new Viewport(0, 0, 1024, 768);
// Assert.AreEqual(1024, viewportAdapter.ViewportWidth);
// Assert.AreEqual(768, viewportAdapter.ViewportHeight);
// Assert.AreEqual(viewportAdapter.ViewportWidth, viewportAdapter.VirtualWidth);
// Assert.AreEqual(viewportAdapter.ViewportHeight, viewportAdapter.VirtualHeight);
// Assert.AreEqual(Matrix.Identity, viewportAdapter.GetScaleMatrix());
// Assert.Equal(1024, viewportAdapter.ViewportWidth);
// Assert.Equal(768, viewportAdapter.ViewportHeight);
// Assert.Equal(viewportAdapter.ViewportWidth, viewportAdapter.VirtualWidth);
// Assert.Equal(viewportAdapter.ViewportHeight, viewportAdapter.VirtualHeight);
// Assert.Equal(Matrix.Identity, viewportAdapter.GetScaleMatrix());
// }
// }
//}
@@ -5,14 +5,14 @@
//using MonoGame.Extended.Tiled;
//using MonoGame.Extended.Tiled.Graphics;
//using NSubstitute;
//using NUnit.Framework;
//using Xunit;
//namespace MonoGame.Extended.Tests.Tiled.Renderers
//{
// [TestFixture]
//
// public class FullMapRendererTest
// {
// [Test]
// [Fact]
// public void Draw_MapObjectLayer_MissingGID_NoGroups()
// {
// var gd = TestHelper.CreateGraphicsDevice();
@@ -38,7 +38,7 @@
// Assert.IsNull(gd.Indices);
// }
// [Test]
// [Fact]
// public void Draw_MapObjectLayer_ShapeObject_NoGroups()
// {
// var gd = TestHelper.CreateGraphicsDevice();
@@ -64,7 +64,7 @@
// Assert.IsNull(gd.Indices);
// }
// [Test]
// [Fact]
// public void Draw_MapObjectLayer_TileObject_OneGroup()
// {
// var gd = TestHelper.CreateGraphicsDevice();
@@ -87,11 +87,11 @@
// r.Draw(new Matrix());
// Assert.IsNotNull(gd.Indices);
// Assert.AreEqual(6, gd.Indices.IndexCount);
// Assert.NotNull(gd.Indices);
// Assert.Equal(6, gd.Indices.IndexCount);
// }
// [Test]
// [Fact]
// public void Draw_MapObjectLayer_NotVisible_NoGroups()
// {
// var gd = TestHelper.CreateGraphicsDevice();
@@ -117,7 +117,7 @@
// Assert.IsNull(gd.Indices);
// }
// [Test]
// [Fact]
// public void Draw_MapObjectLayer_NoObjects_NoGroups()
// {
// var gd = TestHelper.CreateGraphicsDevice();
@@ -139,7 +139,7 @@
// Assert.IsNull(gd.Indices);
// }
// [Test]
// [Fact]
// public void Draw_MapTileLayer_TwoVisible_OneGroup()
// {
// var gd = TestHelper.CreateGraphicsDevice();
@@ -154,11 +154,11 @@
// r.Draw(new Matrix());
// Assert.IsNotNull(gd.Indices);
// Assert.AreEqual(12, gd.Indices.IndexCount);
// Assert.NotNull(gd.Indices);
// Assert.Equal(12, gd.Indices.IndexCount);
// }
// [Test]
// [Fact]
// public void Draw_MapTileLayer_AllBlank_NoGroups()
// {
// var gd = TestHelper.CreateGraphicsDevice();
@@ -176,7 +176,7 @@
// Assert.IsNull(gd.Indices);
// }
// [Test]
// [Fact]
// public void Draw_MapImageLayer_OneGroup()
// {
// var gd = TestHelper.CreateGraphicsDevice();
@@ -190,11 +190,11 @@
// r.Draw(new Matrix());
// Assert.IsNotNull(gd.Indices);
// Assert.AreEqual(6, gd.Indices.IndexCount);
// Assert.NotNull(gd.Indices);
// Assert.Equal(6, gd.Indices.IndexCount);
// }
// [Test]
// [Fact]
// public void Draw_MapNoGroups()
// {
// var gd = TestHelper.CreateGraphicsDevice();
@@ -206,7 +206,7 @@
// Assert.IsNull(gd.Indices);
// }
// [Test]
// [Fact]
// public void Draw_NoMap()
// {
// var gd = TestHelper.CreateGraphicsDevice();
@@ -217,7 +217,7 @@
// Assert.IsNull(gd.Indices);
// }
// [Test]
// [Fact]
// public void CreatePrimatives()
// {
// var gd = TestHelper.CreateGraphicsDevice();
@@ -230,20 +230,20 @@
// var r = new MockRenderer(gd);
// r.CreatePrimitives(new Point(0, 0), region, 0, 0.5f, out vertices, out indexes);
// Assert.AreEqual(4, vertices.Length);
// Assert.AreEqual(new Vector3(0, 0, .5f), vertices[0].Position);
// Assert.AreEqual(new Vector2(0.0234375f, 0.0234375f), vertices[0].TextureCoordinate);
// Assert.AreEqual(new Vector3(32, 0, .5f), vertices[1].Position);
// Assert.AreEqual(new Vector2(0.515625f, 0.0234375f), vertices[1].TextureCoordinate);
// Assert.AreEqual(new Vector3(0, 32, .5f), vertices[2].Position);
// Assert.AreEqual(new Vector2(0.0234375f, 0.515625f), vertices[2].TextureCoordinate);
// Assert.AreEqual(new Vector3(32, 32, .5f), vertices[3].Position);
// Assert.AreEqual(new Vector2(0.515625f, 0.515625f), vertices[3].TextureCoordinate);
// Assert.Equal(4, vertices.Length);
// Assert.Equal(new Vector3(0, 0, .5f), vertices[0].Position);
// Assert.Equal(new Vector2(0.0234375f, 0.0234375f), vertices[0].TextureCoordinate);
// Assert.Equal(new Vector3(32, 0, .5f), vertices[1].Position);
// Assert.Equal(new Vector2(0.515625f, 0.0234375f), vertices[1].TextureCoordinate);
// Assert.Equal(new Vector3(0, 32, .5f), vertices[2].Position);
// Assert.Equal(new Vector2(0.0234375f, 0.515625f), vertices[2].TextureCoordinate);
// Assert.Equal(new Vector3(32, 32, .5f), vertices[3].Position);
// Assert.Equal(new Vector2(0.515625f, 0.515625f), vertices[3].TextureCoordinate);
// CollectionAssert.AreEqual(new[] { 0, 1, 2, 1, 3, 2 }, indexes);
// CollectionAssert.Equal(new[] { 0, 1, 2, 1, 3, 2 }, indexes);
// }
// [Test]
// [Fact]
// public void CreatePrimatives_Offset10()
// {
// var gd = TestHelper.CreateGraphicsDevice();
@@ -256,17 +256,17 @@
// var r = new MockRenderer(gd);
// r.CreatePrimitives(new Point(0, 0), region, 10, 0.5f, out vertices, out indexes);
// Assert.AreEqual(4, vertices.Length);
// Assert.AreEqual(new Vector3(0, 0, .5f), vertices[0].Position);
// Assert.AreEqual(new Vector2(0.0234375f, 0.0234375f), vertices[0].TextureCoordinate);
// Assert.AreEqual(new Vector3(32, 0, .5f), vertices[1].Position);
// Assert.AreEqual(new Vector2(0.515625f, 0.0234375f), vertices[1].TextureCoordinate);
// Assert.AreEqual(new Vector3(0, 32, .5f), vertices[2].Position);
// Assert.AreEqual(new Vector2(0.0234375f, 0.515625f), vertices[2].TextureCoordinate);
// Assert.AreEqual(new Vector3(32, 32, .5f), vertices[3].Position);
// Assert.AreEqual(new Vector2(0.515625f, 0.515625f), vertices[3].TextureCoordinate);
// Assert.Equal(4, vertices.Length);
// Assert.Equal(new Vector3(0, 0, .5f), vertices[0].Position);
// Assert.Equal(new Vector2(0.0234375f, 0.0234375f), vertices[0].TextureCoordinate);
// Assert.Equal(new Vector3(32, 0, .5f), vertices[1].Position);
// Assert.Equal(new Vector2(0.515625f, 0.0234375f), vertices[1].TextureCoordinate);
// Assert.Equal(new Vector3(0, 32, .5f), vertices[2].Position);
// Assert.Equal(new Vector2(0.0234375f, 0.515625f), vertices[2].TextureCoordinate);
// Assert.Equal(new Vector3(32, 32, .5f), vertices[3].Position);
// Assert.Equal(new Vector2(0.515625f, 0.515625f), vertices[3].TextureCoordinate);
// CollectionAssert.AreEqual(new[] { 40, 41, 42, 41, 43, 42 }, indexes);
// CollectionAssert.Equal(new[] { 40, 41, 42, 41, 43, 42 }, indexes);
// }
// }
@@ -3,10 +3,17 @@
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MonoGame.Framework.DesktopGL.Core" Version="3.7.0.7" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MonoGame.Extended.Tiled\MonoGame.Extended.Tiled.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
</Project>
@@ -4,16 +4,16 @@
//using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Compiler;
//using Microsoft.Xna.Framework.Graphics;
//using MonoGame.Extended.Tests;
//using NUnit.Framework;
//using Xunit;
//#endregion
//namespace MonoGame.Extended.Tiled.Tests
//{
// [TestFixture]
//
// public class TiledTilesetTests
// {
// [Test]
// [Fact]
// public void Constructor()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
@@ -25,7 +25,7 @@
// //Assert.IsNull(tiledTileset.GetTileRegion(0));
// }
// [Test]
// [Fact]
// public void GetTileRegion_BlankTile()
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
@@ -37,7 +37,7 @@
// //Assert.IsNull(tiledTileset.GetTileRegion(0));
// }
// [Test]
// [Fact]
// [TestCase(9, Result = false, Description = "Too low")]
// [TestCase(10, Result = true, Description = "Min tile")]
// [TestCase(11, Result = true, Description = "Middle tile")]
@@ -53,7 +53,7 @@
// return tiledTileset.ContainsTileId(id);
// }
// [Test]
// [Fact]
// public void Constructor_NoMargin([Values(0, 2)] int spacing)
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
@@ -62,35 +62,35 @@
// var tiledTileset = new TiledTileset(texture, 1, 32, 32, 4, spacing, 0);
// var region = tiledTileset.GetTileRegion(1);
// Assert.AreEqual(texture, region.Texture);
// Assert.AreEqual(0, region.X);
// Assert.AreEqual(0, region.Y);
// Assert.AreEqual(32, region.Width);
// Assert.AreEqual(32, region.Height);
// Assert.Equal(texture, region.Texture);
// Assert.Equal(0, region.X);
// Assert.Equal(0, region.Y);
// Assert.Equal(32, region.Width);
// Assert.Equal(32, region.Height);
// region = tiledTileset.GetTileRegion(2);
// Assert.AreEqual(texture, region.Texture);
// Assert.AreEqual(spacing + 32, region.X);
// Assert.AreEqual(0, region.Y);
// Assert.AreEqual(32, region.Width);
// Assert.AreEqual(32, region.Height);
// Assert.Equal(texture, region.Texture);
// Assert.Equal(spacing + 32, region.X);
// Assert.Equal(0, region.Y);
// Assert.Equal(32, region.Width);
// Assert.Equal(32, region.Height);
// region = tiledTileset.GetTileRegion(3);
// Assert.AreEqual(texture, region.Texture);
// Assert.AreEqual(0, region.X);
// Assert.AreEqual(spacing + 32, region.Y);
// Assert.AreEqual(32, region.Width);
// Assert.AreEqual(32, region.Height);
// Assert.Equal(texture, region.Texture);
// Assert.Equal(0, region.X);
// Assert.Equal(spacing + 32, region.Y);
// Assert.Equal(32, region.Width);
// Assert.Equal(32, region.Height);
// region = tiledTileset.GetTileRegion(4);
// Assert.AreEqual(texture, region.Texture);
// Assert.AreEqual(spacing + 32, region.X);
// Assert.AreEqual(spacing + 32, region.Y);
// Assert.AreEqual(32, region.Width);
// Assert.AreEqual(32, region.Height);
// Assert.Equal(texture, region.Texture);
// Assert.Equal(spacing + 32, region.X);
// Assert.Equal(spacing + 32, region.Y);
// Assert.Equal(32, region.Width);
// Assert.Equal(32, region.Height);
// }
// [Test]
// [Fact]
// public void Constructor_NoSpacing([Values(0, 2)] int margin)
// {
// var graphicsDevice = TestHelper.CreateGraphicsDevice();
@@ -99,32 +99,32 @@
// var tileset = new TiledTileset(texture, 1, 32, 32, 4, 0, margin);
// var region = tileset.GetTileRegion(1);
// Assert.AreEqual(texture, region.Texture);
// Assert.AreEqual(margin, region.X);
// Assert.AreEqual(margin, region.Y);
// Assert.AreEqual(32, region.Width);
// Assert.AreEqual(32, region.Height);
// Assert.Equal(texture, region.Texture);
// Assert.Equal(margin, region.X);
// Assert.Equal(margin, region.Y);
// Assert.Equal(32, region.Width);
// Assert.Equal(32, region.Height);
// region = tileset.GetTileRegion(2);
// Assert.AreEqual(texture, region.Texture);
// Assert.AreEqual(margin + 32, region.X);
// Assert.AreEqual(margin, region.Y);
// Assert.AreEqual(32, region.Width);
// Assert.AreEqual(32, region.Height);
// Assert.Equal(texture, region.Texture);
// Assert.Equal(margin + 32, region.X);
// Assert.Equal(margin, region.Y);
// Assert.Equal(32, region.Width);
// Assert.Equal(32, region.Height);
// region = tileset.GetTileRegion(3);
// Assert.AreEqual(texture, region.Texture);
// Assert.AreEqual(margin, region.X);
// Assert.AreEqual(margin + 32, region.Y);
// Assert.AreEqual(32, region.Width);
// Assert.AreEqual(32, region.Height);
// Assert.Equal(texture, region.Texture);
// Assert.Equal(margin, region.X);
// Assert.Equal(margin + 32, region.Y);
// Assert.Equal(32, region.Width);
// Assert.Equal(32, region.Height);
// region = tileset.GetTileRegion(4);
// Assert.AreEqual(texture, region.Texture);
// Assert.AreEqual(margin + 32, region.X);
// Assert.AreEqual(margin + 32, region.Y);
// Assert.AreEqual(32, region.Width);
// Assert.AreEqual(32, region.Height);
// Assert.Equal(texture, region.Texture);
// Assert.Equal(margin + 32, region.X);
// Assert.Equal(margin + 32, region.Y);
// Assert.Equal(32, region.Width);
// Assert.Equal(32, region.Height);
// }
// }
//}
+24 -27
View File
@@ -26,34 +26,31 @@ Task("Build")
});
});
// Task("Test")
// .IsDependentOn("Build")
// .Does(() =>
// {
// var testRuns = 0;
// var failedRuns = 0;
Task("Test")
.IsDependentOn("Build")
.Does(() =>
{
var testRuns = 0;
var failedRuns = 0;
// foreach (var project in GetFiles($"./Source/Tests/**/*.Tests.csproj"))
// {
// try
// {
// var filename = project.GetFilename().ChangeExtension("dll");
// var testDll = project.GetDirectory().CombineWithFilePath($"bin/{configuration}/{filename}");
// Information("Test Run {0} - {1}", testRuns++, filename);
// NUnit(testDll.FullPath, new NUnitSettings
// {
// ShadowCopy = false
// });
// }
// catch
// {
// failedRuns++;
// }
// }
foreach (var project in GetFiles($"./Source/Tests/**/*.Tests.csproj"))
{
try
{
// var filename = project.GetFilename().ChangeExtension("dll");
// var testDll = project.GetDirectory().CombineWithFilePath($"bin/{configuration}/netcoreapp2.0/{filename}");
Information("Test Run {0} - {1}", testRuns++, project);
DotNetCoreTest(project.FullPath);
}
catch
{
failedRuns++;
}
}
// if(failedRuns > 0)
// throw new Exception($"{failedRuns} of {testRuns} test runs failed.");
// });
if(failedRuns > 0)
throw new Exception($"{failedRuns} of {testRuns} test runs failed.");
});
// Task("Pack")
// .IsDependentOn("Test")
@@ -72,6 +69,6 @@ Task("Build")
// });
Task("Default")
.IsDependentOn("Build");
.IsDependentOn("Test");
RunTarget(target);