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

  • Home
  • SEARCH
  • 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 8607957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:29:31+00:00 2026-06-12T03:29:31+00:00

I want to unit test a MVP presenter class . but its interaction to

  • 0

I want to unit test a MVP presenter class . but its interaction to the service is not through interface ( it uses a concrete class ) . now I wonder is there anyway to mock service class without being have to change the structure ?

  • 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-06-12T03:29:32+00:00Added an answer on June 12, 2026 at 3:29 am

    The usual way of mocking in C#/VB.NET is by overriding virtual methods with the implementation you require for a particular scenario. For that reason, an interface is the approach most commonly used as all its methods are abstract.

    Is there a reason why you are reluctant to change the service dependency to an interface? An alternative is making the methods you want to test virtual, so you can override them in your mocks, but I would not recommend that, as it is a bit dirty.

    The whole point of unit testing is just testing a particular unit, so having a dependency to an implementation instead of an interface really beats the point.

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

Sidebar

Related Questions

I want to unit test a class, Class A , but it has a
I want to Unit Test my application which use MSMQ but i found no
I want to unit test a RESTful interface written with Apache CXF. I use
I want to create a unit test for integration testing. What class should I
I want a unit-test framework for JavaScript which runs in the browser . Not
I have a couple of MFC applications. I don't want to unit-test UI but
I have a simple Action class which I want to unit test: package com.gam.action.test;
I have the below class I want to unit test: public class MyClass {
I have an EJB which I want to unit test its public methods. I
I have a class library I want to unit test using Microsofts unit test

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.