Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 4.5 and Visual Studio 2012 > BOOK: Professional Visual Studio 2012
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Visual Studio 2012
This is the forum to discuss the Wrox book Professional Visual Studio 2012 by Bruce Johnson; ISBN: 978-1-118-33770-7
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Visual Studio 2012 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 Display Modes
  #1 (permalink)  
Old September 19th, 2013, 03:11 PM
Registered User
Points: 19, Level: 1
Points: 19, Level: 1 Points: 19, Level: 1 Points: 19, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2012
Location: Juneau, AK
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default TestContext in Chapter 11 Unit Testing

I had a problem (page 190) following along after creating the LoadTests database and adding the method.
Code:
public void CurrentStatusDataTest()
        {
            var target = new Subscription();
            var date = this.TestContext.DataRow["PaidUp"] as DateTime?;
            if (date!=null)
        	{
		         target.PaidUpTo=date;
	        }

            var val = Enum.Parse(typeof(Subscription.Status),
                this.TestContext.DataRow["Status"] as string);

            Assert.AreEqual(val, target.CurrentStatus, "Subscription.CurrentStatus was not set correctly.");
        }
There was no recognition of the TestContext. The book did not seem to mention where to put the TestContext object suggesting that it was automatically generated. After looking at the downloadable code and seeing the field and property declared in the SubscriptionTest class
Code:
/// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }
I was wondering if the book was negligent in mentioning what TestContext is, how it works, and when it should be inserted. Also a more expansive detail on how it relates to the DataSource property (step 3, page 189) would be helpful.
 


Thread Tools
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
Chapter 7: Unit Testing with the Unit Testing Framework antwarpes BOOK: Professional Application Lifecycle Management with Visual Studio 2010 3 September 25th, 2011 08:47 AM
Chapter 7 Unit Testing with the Unit Test Framework - examples blaurence46 BOOK: Professional Application Lifecycle Management with Visual Studio 2010 1 September 24th, 2011 10:07 AM
Unit Testing jeffmorris BOOK: Professional XNA Game Programming: For Xbox 360 and Windows ISBN: 978-0-470-12677-6 7 May 14th, 2007 06:51 AM
Unit Testing userrob BOOK: ASP.NET Website Programming Problem-Design-Solution 2 November 9th, 2005 09:35 AM



All times are GMT -4. The time now is 12:01 PM.


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