using NUnit.Framework;
namespace Chernobyl.Mathematics.Collision
{
///
/// A base class test fixture that tests the
/// type. This class also
/// tests the type using the
/// class.
///
/// The type that can be collided with by the
/// .
public abstract class ExtendedCollidableTests : CollidableTests
{
[Test, Description("Checks the IsColliding method to ensure it properly " +
"collides with the collidable passed to it.")]
public virtual void IsColliding()
{
IExtendedCollidable collidable = CreateExtendedCollidable();
Assert.That(collidable.IsColliding(CreateCollidingCollidable()),
"The IsColliding method is reporting that the object passed to " +
"it is not colliding with the test IExtendedCollidable " +
"even though it should be colliding.");
}
[Test, Description("Checks the IsColliding method to ensure it properly " +
"collides with the edge of the collidable passed to it.")]
public virtual void IsCollidingWithEdge()
{
IExtendedCollidable collidable = CreateExtendedCollidable();
Assert.That(collidable.IsColliding(CreateEdgeCollidingCollidable()),
"The IsColliding method is reporting that the object passed to " +
"it is not colliding with the test IExtendedCollidable " +
"even though it should be colliding.");
}
[Test, Description("Checks the IsColliding method to ensure it does not " +
"collides with the collidable passed to it.")]
public virtual void IsNotColliding()
{
IExtendedCollidable collidable = CreateExtendedCollidable();
Assert.That(collidable.IsColliding(CreateNonCollidingCollidable()) == false,
"The IsColliding method is reporting that the object passed to " +
"is colliding with the test IExtendedCollidable " +
"even though it should NOT be colliding.");
}
///
/// Should create an that
/// can be collided against for testing purposes. This method should
/// always create a new
/// and never reuse the same instance.
///
/// The new to
/// test with.
protected abstract IExtendedCollidable CreateExtendedCollidable();
///
/// Should create an that is set up
/// to collide against the
/// created by the method . This method
/// should always create a new
/// and never reuse the
/// same instance.
///
/// The new to test with.
protected abstract TCollidable CreateCollidingCollidable();
///
/// Should create an that is set up
/// to collide against the edge of the
/// created by the method
/// . This method should always create a
/// new and never reuse
/// the same instance.
///
/// The new to test with.
protected abstract TCollidable CreateEdgeCollidingCollidable();
///
/// Should create an that is set up
/// to NOT collide against the
/// created by the method
/// . This method should
/// always create a new
/// and never reuse the same instance.
///
/// The new to test with.
protected abstract TCollidable CreateNonCollidingCollidable();
protected override ICollidable CreateCollidable()
{
return CreateExtendedCollidable();
}
}
}