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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Easy UI Testing: Isolate Your UI Code Before It Invades Your Business Layer

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

The User Interface Process Application Block (UIP) from the Microsoft Patterns & Practices team can help you isolate your UI, write unit tests for your UI logic, and write a UI that really is the thin layer it was always meant to be. Mark Seemann shows you how it's done in this article.

Mark Seemann

MSDN Magazine August 2005

View Complete Post

More Related Resource Links

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

VB code behind the Business Logic Layer ???


Hello. I was hoping for some general help and comments.

I went through a lot of the ASP.Net Web Forms Tutorials.

I also went though the whole "ASP.Net in 24 Hours" book by Scott Mictchell. I followed everything that went on in that book and built the final project successfully. I also used the tutorials here to better understand the whole Membership Provider/User tables setup that was going on in the book.

Next, I thought I would learn more about accessing data for ASP.Net since that is what most application do.

I went through the first Data Tutorial here. I seemed to understand what was going on just fine.

The second Data Tutorial seemed to just show a lot of VB code to build the Business Logic Layer. There was not much explanation about how to do it yourself.

I think I can keep going in the tutorials here. I downloaded the code from the second tutorial and went through it.I am guessing that the code in the second tutorial was given just to proceed with the overall project that is being built throughout the tutorial sequence.

I just wish I understood what is going on in those long lists of VB code. I can see some of what is going on. I don't know VB very well at all. So, what is the next step?

I have started working through a VB book. Will learning VB help me understand the code in that tu

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


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

Testing: Perform Code Coverage Analysis with .NET to Ensure Thorough Application Testing


When running your tests how do you know which parts of your product code are actually executed and tested? This article presents a complete system called Fundamental Function code coverage that operates at the method level. The author gives an overview of the system so you can understand code coverage principles, explains the key parts of the underlying code, and discusses how code coverage fits into the overall product development cycle. After reading this article you will be able to perform code coverage analysis on any .NET software system.

James McCaffrey

MSDN Magazine April 2004

is there any impact of using static methods in Business Access layer in 3 tier applciation


is there any impact of using static methods in Business Access layer in 3 tier applciation,

Please suggest me what are the best practices and standards

How do i pass my datacontract into my business layer without a circular reference????

Ok, this architecture is fairly new to me, so I need a few good pointers.  I've searched the topic, but still don't have a clear understanding on what I'm missing.   I have a presentation layer, which displays my data and forms. I have a WCF service, a business layer and a dataAccess Layer I am trying to read data from on OLD!! foxpro .dbf file.  I've read all the articles on why not pass Datasets, etc so I'm trying to learn how to pass data contracts.  I have the following in my WCF [ServiceContract] public interface IService1 { [OperationContract] void SaveNDFData(string storedprocedure, ndfContractLibrary.NDFDataParam[] ndfData); <strong>[OperationContract] List<ndfContractLibrary.NDFDRawData> getRawNDFD();</strong> } I have a separate library for my dataContracts as i know later I will have several.  I'm using this as a generic List<> [Serializable] [DataContract] public class NDFDRawData { private int batchNumber; [DataMember] public int BatchNumber { get { return batchNumber; } set { batchNumber = value; } } private int sampleNumber; [DataMember] public int SampleNumber { get { return sampleNumber; } set { sampleNumber = value; } } private decimal invitroHour; [Da

VWD Express Doesn't step into the Business Layer Function



I have a solution that consists of some web projects and websites (seperate projects in one solution) When I run the main project and debug I want to step into a function that resides in another project as a business layer function and then step into another function in DAL project. I set breakpoints in both projects (DAL and BLL) but am not able to step into those functions!!!

What is the problem with vwd express, It should support such vital thing. 

DataBinding not updating underlying business object when changing control property from code


I have a custom data form control that in code generates databindings between the selected custom business object (LLBL) and the various controls on the screen. Everything works in that I set the DataContext to the selected business object and the data appears in the GUI. If the user changes anything on screen, the data is getting updated into the business object.

However, now I have some custom logic that when the user presses a button I need to update some fields. Currently I'm setting this data directly into the controls, setting the new value into the property that is bound. However, the data is not getting pushed back into the business object.  I had this same issue building WinForm apps in that databinding only fired if the user was in the control and left it.

Does the same thing apply to WPF? How can I get ANY change on say a TextBox's Text property whether via user interaction or from C# code to push that value into the bound business object property?


Exposing business layer classes in the service (a lot of classes, all one-to-one with the service)


So I have a lot of classes in my business layer which may change over time and  I'd like to expose them in the service layer with as little work as possible. Exposing manually isn't something I want to do because every business class will have all of its properties exposed, meaning I'd be coding the same thing twice (and there are a lot of classes).

I saw an MSDN video where it was suggested writing a helper class but they didn't really delve in to how it would work.

Has anyone got any idea of how to go about this?

Many thanks,


How much web layer input (ex. GridView DataKeys) should be validated in the business layer?


Back in the day when we were mostly submitting forms from one page to another we used to have to validate all post parameters to make sure that the ids somehow belonged to the user that was currently logged in.  After all you didn't want a "hacker" to be able to pull someone else's information.  In modern ASP.NET application in a situation where a lot of these keys are part of server controls (ex DataKeys of GridView) and is stored in ViewState which is supposedly stamped with a hash that gets validated on every post back, does anyone still validate that the key that was retrieved in fact belongs to the user?

I currently do, my business layer methods tend to take an instance of a "profile" object that is maintained in session for each user, the profile contains all basic information including the company etc. that the user is associated with.  Having the profile in every business method I can validate that any piece of information requested by the web layer from the business layer does in fact belong to the user requesting it.  Another thought is that the library (business layer) can also be reused outside of ASP.NET where perhaps the input would not be as secure.  I am wondering if all of this is overkill as all of my basic GetSomething() methods tend to have extra trips to the database to make sure that an ID

Server.MapPath dont have access to web all calls made in business layer


Hi Guys,

I'm trying to find a way to map a path to a pdf object in my business layer.. im using nop commerce and their messagemanager class is in the business layer and all calls to email queuing and the like are done in the business layer..

i would love to know if there's a way to do it without having the ability to pass the path in from the web layer..

my backup plan is an appsetting in web.config.. but hoped it wouldn't come to that?!

Using Dynamic Data against Business Layer



Has anyone successfully used Dynamic Data against their business object.  I found a snipet of code that used Microsoft.Web.DynamicData from the Dynamic Data Futures sample project to bind to an object called AggregateData but importing the assembly causes ambigous references amoung other errors.

Also I have a Repository model (ProductManager in my case) that performs all the CRUD with business logic against the Entity Framework.  I would like to use my ProductManager object directly with the Dynamic Data rather than using the ObjectContext directly.  The sample shows an example of using the DynamicObjectDataSource which references the business object.  

My primary question is how can I accomplish this using the latest version of Dynamic Data from DynamicDataPreview4.  Does anyone have a sample connecting to a business object via the normal ObjectDataSource included with VS 2008 SP1. 


Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.

Six easy ways to customize your site using Web Parts in SharePoint

Becoming familiar with Web Part customization techniques gives you a range of page-customization choices. For example, you can customize your site's home page so that it displays the specific information that your team needs. You can rearrange the list items on the home page, add lists, and even change the images on the home page. As you become more familiar with Web Part Page customization techniques, you can build interactive Web Part Pages that makes the data in lists more dynamic and useful, and you can add new Web Parts that provide access to external data and Web services.

Free Code Snippets - ASP.NET

You Can Find Useful ASP.NET Related Posts on the above link.

Free Code Snippets - C#

Free C# Code Snippets

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.
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