Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1958448
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T08:19:25+00:00 2026-05-17T08:19:25+00:00

My application I have an application design that looks like this: web application layer

  • 0

My application

I have an application design that looks like this:

  • web application layer – asp.net MVC app with controllers and views that use POCOs and call services
  • service layer – business processes that use POCOs and call repositories
  • data layer – repositories that use POCOs and communicate with the model in the form of EF model which is part of this same layer
  • POCO layer – defines all classes that are used for inter communication between these layers

So my data layer is completely transparent to data model implementation because upper layer don’t use data entities at all.

Testing

As much as I understand unit, integration and system testing (with relation to Asp.net MVC) is this:

  • unit testing – this one’s easy. Mock decoupled objects and inject them in your unit test so tested unit will use them
  • integration testing – should make a group of production functionality units and mock the rest: so writing integration tests that would test controller, service and repository integration without actually using production database
  • system testing – run tests on all layers without any mocking, meaning I have to use production (test) database as well

Problem

I can easily see how to write unit tests as well as system tests, but I don’t know how to write integration tests? Maybe my view of these is completely distorted and I don’t understand them at all.

How should one write integration and system tests for an Asp.net MVC application?
Or any .net application for that matter?

Some code that helps explain the problem

Suppose I have classes like:

  • TaskController calls into TaskService
  • TaskService calls into TaskRepository
  • TaskRepository manipulate EF data internally

So here are my (abbreviated) classes:

public class TaskController
{
    private ITaskService service;

    // injection constructor
    public TaskController(ITaskService service)
    {
        this.service = service;
    }

    // default constructor
    public TaskController() : this(new TaskService()) {}

    public ActionResult GetTasks()
    {
        return View(this.service.GetTasks());
    }
    ...
}

public class TaskService : ITaskService
{
    private ITaskRepository repository;

    // injection constructor
    public TaskService(ITaskRepository repository)
    {
        this.repository = repository;
    }

    // default constructor
    public TaskService() : this(new TaskRepository()) {}

    public IList<Task> GetTasks()
    {
        return this.repository.GetTasks();
    }
    ...
}

public class TaskRepository : ITaskRepository
{
    public IList<Task> GetTasks()
    {
        // code that gets tasks from EF and converts to Task POCOs
    }
    ...
}

Unit test is simple and would look like this:

public void UnitTest()
{
    var mock = new Mock<ITaskService>();
    // other code that mocks the service

    TaskController controller = new TaskController(mock.Object);

    // do the test
}

But when it comes to an integration test, how do I mock only certain parts of the integration.

public void IntegrationTest()
{
    // no mocking at all
    TaskController = new TaskController();
    // do some testing
}

First of all I can’t just mock database here? I could mock repository and have real service and controller though…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T08:19:25+00:00Added an answer on May 17, 2026 at 8:19 am

    Integration tests should test the integration between components. While unit tests test individual pieces of a single component, integration tests the interactions between components, and are meant to work live. So an integration test would utilize a database and any other external dependencies, where its best to mock these services in unit testing.

    System test to me would be functional testing (another level of testing using something like fit), or ui testing through a tool like testcomplete or telerik’s QA tool.

    HTH.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have started design of a ColdFusion application that is entirely web based. Not
Does someone have any tips/advice on database design for a web application? The kind
What do I have to consider in database design for a new application which
We have a Hibernate/Spring application that have the following Spring beans: <bean id=transactionManager class=org.springframework.orm.hibernate3.HibernateTransactionManager
In my application I have TextBox in a FormView bound to a LinqDataSource like
In my application I have a DataGridView control that displays data for the selected
In my current application I have a form that requires the user to enter
This is a design question. Background: We get a web request into our system
I have an game application I have written for Windows Mobile and I want
In my application I have a window which I popup with small messages on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.