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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:48:03+00:00 2026-05-13T17:48:03+00:00

I am a bit confused from wiki: This means that a true mock… performing

  • 0

I am a bit confused

from wiki:
“This means that a true mock… performing tests on the data passed into the method calls as arguments.”

I never used unit testing or mock framework. I thought unit tests are for automated tests so what are mock tests for?

What I want is a object replacing my database I might use later but still dont know what database or orm tool I use.

When I do my programm with mocks could I easily replace them with POCO`s later to make entity framework for example working pretty fast?

edit: I do not want to use unit testing but using Mocks as a full replacement for entities + database would be nice.

  • 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-13T17:48:03+00:00Added an answer on May 13, 2026 at 5:48 pm

    Yes, I think you are a bit confused.

    Mock frameworks are for creating “Mock” objects which basically fake part of the functionality of your real objects so you can pass them to methods during tests, without having to go to the trouble of creating the real object for testing.

    Lets run through a quick example

    Say you have a ‘Save()’ method that takes a ‘Doc’ object, and returns a ‘boolean’ success flag

    public bool Save(Doc docToSave(){...}
    

    Now if you want to write a unit test for this method, you are going to have to first create a document object, and populate it with appropriate data before you can test the ‘Save()’ method. This requires more work than you really want to do.

    Instead, it is possible to use a Mocking framework to create a mock ‘Doc’ object for you.

    Syntax various between frameworks, but in pseudo-code you would write something like this:

    CreateMock of type Doc
    SetReturnValue for method Doc.data = "some test data"
    

    The mocking framework will create a dummy mock object of type Doc that correctly returns “some test data” when it’s ‘.data’ property is called.

    You can then use this dummy object to test your save method:

    public void MyTest()
    {
        ...
        bool isSuccess = someClass.Save(dummyDoc);
        ...
    }
    

    The mocking framework ensures that when your ‘Save()’ method accesses the properties on the dummyDoc object, the correct data is returned, and the save can happen naturally.

    This is a slightly contrived example, and in such a simple case it would probably be just as easy to create a real Doc object, but often in a complex bit software it might be much harder to create the object because it has dependencies on other things, or it has requirements for other things to be created first. Mocking removes some of that extra overload and allows you to test just the specific method that you are trying to test and not worry about the intricacies of the Doc class as well.

    Mock tests are simply unit tests using mocked objects as opposed to real ones. Mocked objects are not really used as part of actual production code.

    If you want something that will take the place of your database classes so you can change your mind later, you need to write interfaces or abstract classes to provide the methods you require to match your save/load semantics, then you can fill out several full implementations depending on what storage types you choose.

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

Sidebar

Related Questions

I'm a bit confused as to why this isn't working; I assume that because
I'm a bit confused about displaying data from a MySQL database. I would like
I am a bit confused here. This is from a great C book, and
Bit confused about this. I was under the impression that if you added server
This is a bit confused question for those who don't now advanced SQL... However.
I am a bit confused about the difference between Silverlight and Expression Blend. From
I am a bit confused. I know that by using Formset we could generate
I am a bit confused about this function definition in Prolog: sample(X,[X|Tail]) :- member(X,Tail).
I'm a bit confused from File::Find documentation... What is the equivalent to $ find
I am a bit confused. I know I can create class derived from EventArgs

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.