- Added a full test set for the GameServiceContainer class

- Searched the svn log and replaced a lot of ??? Developer attributes with the real ones.
This commit is contained in:
SND\AstrorEnales_cp 2012-10-13 21:36:46 +00:00 committed by Konstantin Koch
parent 783a448db1
commit 174fc74b4e
28 changed files with 135 additions and 44 deletions

View File

@ -37,6 +37,7 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL" />
<Reference Include="nunit.framework">
@ -62,6 +63,7 @@
<Compile Include="ReflectionLearningTests.cs" />
<Compile Include="Strukturen\CurveKeyCollectionTest.cs" />
<Compile Include="Strukturen\CurveKeyTest.cs" />
<Compile Include="Strukturen\GameServiceContainerTest.cs" />
<Compile Include="Strukturen\Graphics\PackedVector\Alpha8Test.cs" />
<Compile Include="Strukturen\Input\GamePadButtonsTest.cs" />
<Compile Include="Strukturen\Input\GamePadDPadTest.cs" />

View File

@ -37,6 +37,7 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL" />
<Reference Include="nunit.framework">
@ -62,6 +63,7 @@
<Compile Include="ReflectionLearningTests.cs" />
<Compile Include="Strukturen\CurveKeyCollectionTest.cs" />
<Compile Include="Strukturen\CurveKeyTest.cs" />
<Compile Include="Strukturen\GameServiceContainerTest.cs" />
<Compile Include="Strukturen\Graphics\PackedVector\Alpha8Test.cs" />
<Compile Include="Strukturen\Input\GamePadButtonsTest.cs" />
<Compile Include="Strukturen\Input\GamePadDPadTest.cs" />

View File

@ -37,6 +37,7 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL" />
<Reference Include="nunit.framework">
@ -63,6 +64,7 @@
<Compile Include="ReflectionLearningTests.cs" />
<Compile Include="Strukturen\CurveKeyCollectionTest.cs" />
<Compile Include="Strukturen\CurveKeyTest.cs" />
<Compile Include="Strukturen\GameServiceContainerTest.cs" />
<Compile Include="Strukturen\Graphics\PackedVector\Alpha8Test.cs" />
<Compile Include="Strukturen\Input\GamePadButtonsTest.cs" />
<Compile Include="Strukturen\Input\GamePadDPadTest.cs" />

View File

@ -39,6 +39,7 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Content.Pipeline, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
<Reference Include="Microsoft.Xna.Framework.Storage, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=MSIL" />
<Reference Include="nunit.framework">
@ -64,6 +65,7 @@
<Compile Include="ReflectionLearningTests.cs" />
<Compile Include="Strukturen\CurveKeyCollectionTest.cs" />
<Compile Include="Strukturen\CurveKeyTest.cs" />
<Compile Include="Strukturen\GameServiceContainerTest.cs" />
<Compile Include="Strukturen\Graphics\PackedVector\Alpha8Test.cs" />
<Compile Include="Strukturen\Input\GamePadButtonsTest.cs" />
<Compile Include="Strukturen\Input\GamePadDPadTest.cs" />

View File

@ -0,0 +1,89 @@
using System;
using NUnit.Framework;
using XNAGameServiceContainer = Microsoft.Xna.Framework.GameServiceContainer;
using ANXGameServiceContainer = ANX.Framework.GameServiceContainer;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.Framework.TestCenter.Strukturen
{
[TestFixture]
public class GameServiceContainerTest
{
[Test]
public void GetServiceWithoutRegisteredService()
{
var xna = new XNAGameServiceContainer();
var anx = new ANXGameServiceContainer();
Assert.Null(xna.GetService(typeof(int)));
Assert.Null(anx.GetService(typeof(int)));
Assert.AreEqual(xna.GetService(typeof(int)), anx.GetService(typeof(int)));
}
[Test]
public void GetServiceWithNullType()
{
var xna = new XNAGameServiceContainer();
var anx = new ANXGameServiceContainer();
AssertHelper.ConvertEquals(Assert.Throws<ArgumentNullException>(() => xna.GetService(null)),
Assert.Throws<ArgumentNullException>(() => anx.GetService(null)), "GetServiceWithNullType");
}
[Test]
public void AddServiceWithNullType()
{
var xna = new XNAGameServiceContainer();
var anx = new ANXGameServiceContainer();
AssertHelper.ConvertEquals(Assert.Throws<ArgumentNullException>(() => xna.AddService(null, null)),
Assert.Throws<ArgumentNullException>(() => anx.AddService(null, null)), "AddServiceWithNullType");
}
[Test]
public void AddServiceWithNullProvider()
{
var xna = new XNAGameServiceContainer();
var anx = new ANXGameServiceContainer();
AssertHelper.ConvertEquals(Assert.Throws<ArgumentNullException>(() => xna.AddService(typeof(int), null)),
Assert.Throws<ArgumentNullException>(() => anx.AddService(typeof(int), null)), "AddServiceWithNullProvider");
}
[Test]
public void RemoveServiceWithNullType()
{
var xna = new XNAGameServiceContainer();
var anx = new ANXGameServiceContainer();
AssertHelper.ConvertEquals(Assert.Throws<ArgumentNullException>(() => xna.RemoveService(null)),
Assert.Throws<ArgumentNullException>(() => anx.RemoveService(null)), "RemoveServiceWithNullType");
}
[Test]
public void RemoveServiceWithoutRegisteredService()
{
var xna = new XNAGameServiceContainer();
var anx = new ANXGameServiceContainer();
Assert.DoesNotThrow(() => xna.RemoveService(typeof(int)));
Assert.DoesNotThrow(() => anx.RemoveService(typeof(int)));
}
[Test]
public void AddAndGetService()
{
var xna = new XNAGameServiceContainer();
var anx = new ANXGameServiceContainer();
xna.AddService(typeof(int), 15);
anx.AddService(typeof(int), 15);
Assert.AreEqual(xna.GetService(typeof(int)), anx.GetService(typeof(int)));
}
}
}

View File

@ -9,6 +9,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Audio
{
[PercentageComplete(30)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Untested)]
public struct AudioCategory : IEquatable<AudioCategory>
{

View File

@ -8,6 +8,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Audio
{
[PercentageComplete(5)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Untested)]
public sealed class Cue : IDisposable
{

View File

@ -8,6 +8,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Audio
{
[PercentageComplete(0)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Untested)]
public class SoundBank : IDisposable
{

View File

@ -8,6 +8,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Audio
{
[PercentageComplete(0)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Untested)]
public class WaveBank : IDisposable
{

View File

@ -12,7 +12,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("???")]
[Developer("xToast, Glatzemann")]
[TestState(TestStateAttribute.TestState.InProgress)]
public struct BoundingBox : IEquatable<BoundingBox>
{

View File

@ -13,7 +13,7 @@ namespace ANX.Framework
{
[PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.InProgress)]
[Developer("???, Glatzemann")]
[Developer("xToast, Glatzemann")]
public class BoundingFrustum : IEquatable<BoundingFrustum>
{
#region fields

View File

@ -13,7 +13,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("???")]
[Developer("xToast")]
[TestState(TestStateAttribute.TestState.InProgress)]
public struct BoundingSphere : IEquatable<BoundingSphere>
{
@ -416,16 +416,14 @@ namespace ANX.Framework
}
#endregion
#region ToString
public override string ToString()
{
var culture = CultureInfo.CurrentCulture;
// This may look a bit more ugly, but String.Format should
// be avoided cause of it's bad performance!
return "{Center:" + Center.ToString() +
" Radius:" + Radius.ToString(culture) + "}";
}
#endregion
#region ToString
public override string ToString()
{
var culture = CultureInfo.CurrentCulture;
// This may look a bit more ugly, but String.Format should be avoided cause of it's bad performance!
return "{Center:" + Center.ToString() + " Radius:" + Radius.ToString(culture) + "}";
}
#endregion
#region IEquatable implementation
public override bool Equals(Object obj)

View File

@ -9,7 +9,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("???")]
[Developer("Glatzemann, SilentWarrior")]
[TestState(TestStateAttribute.TestState.InProgress)]
public struct Color : IPackedVector<uint>, IPackedVector, IEquatable<Color>
{

View File

@ -12,6 +12,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
public abstract class ContentTypeReader
{
/// <summary>
@ -55,6 +56,8 @@ namespace ANX.Framework.Content
protected internal abstract object Read(ContentReader input, object existingInstance);
}
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
public abstract class ContentTypeReader<T> : ContentTypeReader
{
/// <summary>

View File

@ -780,7 +780,7 @@ namespace ANX.Framework.Content
}
/* EXCEPTIONS */
public class UnsupportedWindowSizeRange : Exception
internal class UnsupportedWindowSizeRange : Exception
{
}
}

View File

@ -8,7 +8,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("???")]
[Developer("floAr, Glatzemann")]
[TestState(TestStateAttribute.TestState.Tested)]
public class CurveKey : IEquatable<CurveKey>, IComparable<CurveKey>
{

View File

@ -10,7 +10,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("???, AstrorEnales")]
[Developer("floAr, AstrorEnales")]
[TestState(TestStateAttribute.TestState.Tested)]
public class CurveKeyCollection : ICollection<CurveKey>, IEnumerable<CurveKey>, IEnumerable
{

View File

@ -12,11 +12,11 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.Untested)]
[TestState(TestStateAttribute.TestState.Tested)]
[Developer("Glatzemann")]
public class GameServiceContainer : IServiceProvider
{
private Dictionary<Type, Object> services;
private readonly Dictionary<Type, Object> services;
public GameServiceContainer()
{
@ -44,7 +44,7 @@ namespace ANX.Framework
throw new ArgumentNullException("type");
}
Object obj = null;
Object obj;
this.services.TryGetValue(type, out obj);
return obj;
}

View File

@ -38,7 +38,7 @@ SOFTWARE.
namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("???")]
[Developer("Glatzemann, rene87")]
[TestState(TestStateAttribute.TestState.Tested)]
public static class MathHelper
{

View File

@ -12,7 +12,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(70)]
[Developer("???")]
[Developer("Glatzemann, GinieDp, rene87, floAr")]
[TestState(TestStateAttribute.TestState.InProgress)]
public struct Matrix : IEquatable<Matrix>
{

View File

@ -12,7 +12,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("???")]
[Developer("floAr, GinieDp")]
[TestState(TestStateAttribute.TestState.InProgress)]
public struct Plane : IEquatable<Plane>
{

View File

@ -9,7 +9,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("???")]
[Developer("Glatzemann")]
[TestState(TestStateAttribute.TestState.InProgress)]
public struct Point : IEquatable<Point>
{

View File

@ -12,7 +12,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("???")]
[Developer("floAr, GinieDp")]
[TestState(TestStateAttribute.TestState.InProgress)]
public struct Quaternion : IEquatable<Quaternion>
{

View File

@ -8,7 +8,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("???")]
[Developer("floAr")]
[TestState(TestStateAttribute.TestState.InProgress)]
public struct Ray : IEquatable<Ray>
{

View File

@ -9,7 +9,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("???")]
[Developer("Glatzemann, GinieDp")]
[TestState(TestStateAttribute.TestState.InProgress)]
public struct Rectangle : IEquatable<Rectangle>
{

View File

@ -9,7 +9,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("???")]
[Developer("xToast, GinieDp")]
[TestState(TestStateAttribute.TestState.InProgress)]
public struct Vector2 : IEquatable<Vector2>
{
@ -444,8 +444,7 @@ namespace ANX.Framework
public override string ToString()
{
var culture = CultureInfo.CurrentCulture;
// This may look a bit more ugly, but String.Format should
// be avoided cause of it's bad performance!
// This may look a bit more ugly, but String.Format should be avoided cause of it's bad performance!
return "{X:" + X.ToString(culture) + " Y:" + Y.ToString(culture) + "}";
}
#endregion

View File

@ -12,7 +12,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("???")]
[Developer("xToast, GinieDp")]
[TestState(TestStateAttribute.TestState.InProgress)]
public struct Vector3 : IEquatable<Vector3>
{
@ -714,8 +714,7 @@ namespace ANX.Framework
public override string ToString()
{
var culture = CultureInfo.CurrentCulture;
// This may look a bit more ugly, but String.Format should
// be avoided cause of it's bad performance!
// This may look a bit more ugly, but String.Format should be avoided cause of it's bad performance!
return "{X:" + X.ToString(culture) +
" Y:" + Y.ToString(culture) +
" Z:" + Z.ToString(culture) + "}";

View File

@ -12,7 +12,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("???")]
[Developer("xToast, GinieDp")]
[TestState(TestStateAttribute.TestState.InProgress)]
public struct Vector4 : IEquatable<Vector4>
{
@ -597,20 +597,11 @@ namespace ANX.Framework
public override string ToString()
{
var culture = CultureInfo.CurrentCulture;
// This may look a bit more ugly, but String.Format should
// be avoided cause of it's bad performance!
// This may look a bit more ugly, but String.Format should be avoided cause of it's bad performance!
return "{X:" + X.ToString(culture) +
" Y:" + Y.ToString(culture) +
" Z:" + Z.ToString(culture) +
" W:" + W.ToString(culture) + "}";
//return string.Format(culture, "{{X:{0} Y:{1} Z:{2} W:{3}}}", new object[]
//{
// this.X.ToString(culture),
// this.Y.ToString(culture),
// this.Z.ToString(culture),
// this.W.ToString(culture)
//});
}
public float Length()