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 315761
In Process

The Archive Base Latest Questions

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

I am still confused of when I have to make a wrapper and interface

  • 0

I am still confused of when I have to make a wrapper and interface to fake my tests.

Like in a book I am reading about MVC the author uses the Moq framework.

So the author first makes a IFormAuthentication interface.

Writes some methods there and then makes a WrapperClass that implements these methods and then writes the actual code for the methods(ie signout).

So then in Moq he just uses the interface. So this makes sense to me but correct me if I am wrong.

He is doing this because he wants moq to make a fake mockup by using the interface? Then in MVC application he has it step up so that if the interface is null it will then make a new wrapper class.

So I am guessing this is so when it time to actually run it uses the wrappers that actually contains the real methods so that the application will work as it should.

So hopefully I got that right.

Now he goes on to do the Membership ones and he is says something like “look how many methods I would have to implement with an interface(I am also guessing he would make a wrapper too)”.

Instead we will get Moq to do it and then he passes to Moq MembershipProvider and it creates all this stuff.

So my questions is how did he know? Like how is it on one hand you can’t do FormsAuthentication methods this way but you can do the MembershipProvider?

I don’t even think you can do Like just Membership it has to be MembershipProvider.

So where do I get this information? Like I want to do my SMTP(MailMessage) and I want to know if I have to write an interface and then a wrapper or can I do the same thing like MembershipProvider?

I am not sure I don’t know how to tell.

Thanks

  • 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-12T08:19:17+00:00Added an answer on May 12, 2026 at 8:19 am

    The reason why the author didn’t extract an interface for MembershipProvider is because it is already an abstract class, so it serves excellently as a Test Double already.

    In other words: Extracting an interface is necessary only if you want to abstract away a class that is outside of your control. In that case, you can then make an Adapter that wraps the real implementation, while still providing the ability to replace the real implementation with a Test Double.

    When it comes to Abstractions, interfaces and base classes with virtual members are conceptually equivalent.

    You can read more about Test Doubles in the excellent xUnit Test Patterns.

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

Sidebar

Related Questions

I have read few articles about table partioning but still I am bit confused
I have some questions about some things in Asp.net MVC that still confuses me.
I have perused all related threads on SO but still confused about how to
After a year or so of MVC experience I'm still confused about one thing:
I have been reading around this subject all morning, but I am still confused
I've read a few posts on this but I'm still confused. I have this
I have read many answers regarding this still i am getting confused if i
After a long search I'm still confused about it although I found some related
I can't believe I'm still confused about this but, any way, lets finally nail
This question may sprout from the fact that I'm still confused about context and

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.