c# - Unit testing XNA: Do I need to Mock my GraphicsDevice -


I'm fooling around with the XNA framework.
To help me around I created an assistant class that looks like this:

  ActorHolder + SpriteBatch (SpriteBatch) + ContentManager - Drawable (IList & LT; IDRAVABLE> - Updateatables (IList & lt; IUpdatable & gt;) + ActorHolder (GraphicsDevice, ContentManager) + GameTime + Update + AddActor (IActor) + GetAccess (IActor) + GetCollidingActors (IActor) / Code> 

Now I want to test this class unit. But as you see, my constructor needs a graphics device and a content manager, while I think it makes sense in my application, it is not in my tests. I just have to test the unit In order for these two should be fake or my design is flawed

-. UPDATE -
I have found a link for a project that can help: There is no XP with it, because coding has to be made a bit of space for social life.

- Note -> I'm sorry my UML does not use French, my company. I have never used this except by leaving it back in school. After the text "itemprop =" text ">

I'm actually" joking "the graphics device by creating a real one on an invisible window.

. The peak buffer selected for approximately 1500 tests

This allows me to test the need for a graphics tool (and some basic validation) such as the correct texture set, Done - performance is surprisingly good .., etc.). It can be improved using the rasterizer reference in the context of more intense scrutiny by directX debug runtime.

If I have to verify that what is sent to the graphics device, then I can create an interface through which the code-under-test can send to the corner - which is easy with the standard mock object framework. Can be joke.

Check this question for another discussion about the joke of XNA graphics device dependent classes:

Classes that I use to "fake" using a real graphics device I am:,

(edit: broken links have been fixed)


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -