.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Asad Ali
Post New Web Links

Unit Testing: Mock Objects to the Rescue! Test Your .NET Code with NMock

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net
 

The problem: unit testing libraries, especially data access components, that have a complex set of dependencies. The solution: providing a dynamic mock implementation of your data access classes. Here the author explains just how to make testing easier and more reliable using NMock.

Mark Seemann

MSDN Magazine October 2004




View Complete Post


More Related Resource Links

Generation Test: Automated Unit Tests for Legacy Code with Pex

  

Creating and maintaining a unit test suite for legacy code can be a challenge. Pex automatically produces a small test suite with high code and assertion coverage.

Nikhil Sachdeva

MSDN Magazine December 2009


Toolbox: Cross Browser Testing, Mock Objects, and Raymond Chen

  

This month test your web site on many platforms and browsers without setting up a test environment, use mock objects for unit testing, and visit Raymond Chen.

Scott Mitchell

MSDN Magazine June 2008


Unit Testing: Apply Test-Driven Development to your Database Projects

  

Jamie Laflen extols the benefits of TDD when applied to database development-and supplies some useful techniques along the way.

Jamie Laflen

MSDN Magazine Launch 2008


Unit Testing: Exploring The Continuum Of Test Doubles

  

Creating and using mock component servers simplifies unit testing. Use these examples to get started.

Mark Seemann

MSDN Magazine September 2007


Know Thy Code: Simplify Data Layer Unit Testing using Enterprise Services

  

If you want to employ unit testing and test-driven development techniques in your database application development process, you'll have different factors to consider than you do when you're not involving a database. For example, you have to maintain a consistent state within the database and be able to roll back transactions when necessary. This article shows you how to get the best of unit testing for your database apps in a safe, usable manner.

Roy Osherove

MSDN Magazine June 2005


Unit Testing Error - The unit test adapter failed to connect to the data source or to read the data

  

I'm using VSTS 2K8 and I've set up a Unit Test Project. In it, I have a test class with a method that does a simple assertion. I'm using an Excel 2007 spreadsheet as my data source.

My test method looks like this:

        [DataSource("System.Data.Odbc",  
       
"Dsn=Excel Files;dbq=|DataDirectory|\\MyTestData.xlsx;defaultdir=C:\\TestData;driverid=1046;maxbuffersize=2048;pagetimeout=5",
 
       
"Sheet1",
 
       
DataAccessMethod.Sequential)]
 
   
[DeploymentItem("MyTestData.xlsx")]
 
   
[TestMethod()]
 
   
public void State_Value_Is_Set()
 
&nbs

Unit Testing SharePoint - Past, Present, and Sporm

  
As I described in SharePoint: The Wild West of Software Development there is a serious problem when you develop for SharePoint: ensuring quality through unit testing is really, really hard. And that's where a new open source tool just released today called sporm (SharePoint Object Relational Mapper) comes in. While sporm provides many benefits besides simplified unit testing I wanted to focus on this topic first, because sporm's approach, which models the entity framework in the way it supports POCO's, is a unique feature not available with other SharePoint tools like LINQ to SharePoint.

Test Run: Fault Injection Testing with TestApi

  

Fault injection testing is the process of deliberately inserting an error into an application to determine whether it deals with the error properly. We'll explain how you can introduce faults into .NET applications at run time using the Managed Code Fault Injection APIs of the TestApi library

James McCaffrey

MSDN Magazine August 2010


Test Run: Testing Silverlight Apps Using Messages

  

Silverlight greatly simplifies the process of building rich Web applications, and we'll walk through an example of using Messages as a quick method of interactively testing simple Silverlight apps.

James McCaffrey

MSDN Magazine March 2010


Test Run: WCF Service Testing with Sockets

  

There are many ways to test WCF services, but the socket-based approach is flexible and very useful for security and performance testing. We show you show you how to test a WCF service using a network socket based approach.

James McCaffrey

MSDN Magazine February 2010


Test Run: Pairwise Testing with QICT

  

In this month's column, James McCaffrey explains exactly what pairwise testing is and provides you with complete C# source code for a production quality pairwise testing tool named QICT.

James McCaffrey

MSDN Magazine December 2009


Test Run: Partial Anitrandom String Testing

  

This column presents an approach to Antirandom (AR) testing the author calls partial AR string testing, which can be used to test a wide range of software systems.

James McCaffrey

MSDN Magazine October 2009


Test Run: Request-Response Testing With F#

  

This month we show you how to use F# to perform HTTP request-response testing for ASP.NET Web applications.

James McCaffrey

MSDN Magazine July 2009


Test-Driven Design: Using Mocks And Tests To Design Role-Based Objects

  

Use Test-Driven Development with mock objects to design object oriented code in terms of roles and responsibilities, not categorization of objects into class hierarchies.

Isaiah Perumalla

MSDN Magazine June 2009


Test Run: .NET Module Testing with IronPython

  

This month we demonstrate how easy it is to use IronPython to test .NET-based libraries.

James McCaffrey

MSDN Magazine June 2009


Test Run: Configuration Testing With Virtual Server, Part 2

  

Because Virtual Server is built upon a set of COM modules, you can automate the creation and testing of virtual machines. Here we use Windows PowerShell to run the tests.

Dr. James McCaffrey and Paul Despe

MSDN Magazine December 2008


Test Run: Group Determination In Software Testing

  

There is a large body of research on group techniques to determine the best alternative from a set of options. Dr. James McCaffrey outlines five of them.

Dr. James McCaffrey

MSDN Magazine November 2008


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend