Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6
This is the forum to discuss the Wrox book Professional XNA Game Programming: For Xbox 360 and Windows by Benjamin Nitschke; ISBN: 9780470126776
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 20th, 2007, 11:58 PM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Where are all the unit tests?

Hi,

One of the reasons I bought the book is because of Benjamin's emphasis on unit tests...but in the first four chapters of the code, I cannot find the unit test class.

For example, in chapter 4, TestGame is the class responsible for the unit tests. Alas, nowhere in the book is the code for TestGame shown, and TestGame cannot be found inside the downloaded code.

Did I miss something?

  #2 (permalink)  
Old July 17th, 2007, 05:39 PM
Registered User
 
Join Date: Jul 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It is in the TestGame.cs file in the Game folder in the source code.

There is a BaseGame class which does things that need to happen in the unit test environment and in the full game. For example the code to get the screen resolution and remember it is in the Initialize() method of the BaseGame class. The TestGame class and the main game class inherit from this so do not need do this themselves.

The TestGame class does very little and makes it useful to isolate the one part of your code you are testing. The idea is, you store the code you want to test in a delegate (a type of object that can hold code), call the TestGame.Start() method and it then creates the stripped down TestGame class for you but remembers the code you passed in so that it can be ran during the Draw() method of the TestGame class.

Read through it and it will make more sense. A good one is the TestBackgroundBoxes test in the TetrisGame.cs file in Chapter 4's source. Then look at the TestGame.Start() method in TestGame.cs, look at the constructor on line 41 and finally look at the Draw method in that file. The program.cs file shows how you choose between tests.

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Failing DAO Tests dgalehouse BOOK: Beginning Spring Framework 2 ISBN: 978-0-470-10161-2 13 September 28th, 2009 07:13 PM
Chapter 2 AD HOC Testdriven.net tests? phsarjk BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 1 May 17th, 2007 04:12 PM
PHP Editor: beta tests Luckasoft Pro PHP 2 March 13th, 2005 09:09 PM



All times are GMT -4. The time now is 04:02 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.