I'm doing a hobby game project using Visual Studio 2015 and XNA, via the MonoGame implementation. I wanted to do some unit testing, as I recently discovered this feature in Visual Studio, and want to get a feel for how it can be used.
The problem is, I can't get it to work with the XNA Game object, or anything derived from it.
This is a simple instantiation test I made:
[TestMethod()]
public void MyTest()
{
try
{
MyObject Test = new MyObject();
}
catch
{
// Fail the test if any exception occurs in the constructor.
Assert.Fail();
}
}
Whenever I use my own object in place of MyObject
, the test passes. When I use MyGame
(derived from Game
and with my own properties/methods), the test fails. I've tested the same object in the debugger, and it doesn't throw an exception.
Any idea what I'm doing wrong, or is the Game
class just incompatible with Visual Studio unit testing?