What is Mock testing ( MOQ) ?

preview_player
Показать описание

See our other Step by Step video series below :-

In this video we will see what is mock testing. We will also demonstrate how to do mock testing using MOQ framework.This complete demonstration is done using c# and VSTS unit test framework.
Рекомендации по теме
Комментарии
Автор

Do not miss our Interview Question video series

dnfvideo
Автор

8 year old video still I should say I haven't found such a session on unit testing . It is simple, easily understandable and unique :-) . Thanks

chandanguptaSDET
Автор

"specify which function you want to bypass"

Haven't seen anyone mention this yet but I think it's crucial, thanks for showing with the breakpoint as well

triphazard
Автор

If you check around 1:22 or so, the SendEmail method returns bool and is successful if true is returned. Returns(false); works since the return type is valid, but for the purpose of verifying the targeted method (AddCustomer), the actual returned value from the SendEmail method is irrelevant.

AlexanderTeno
Автор

10 years later! This video is still awesome! Thanks for this

ssyedyaseens
Автор

GREAT example. Simple and to the point to understand the concept of MOQ. Nicely done.

briandaoust
Автор

Dude, a million thank you! I have been banging my head for two weeks with Ninject and Moq, and now I am getting the hang of it!!! 

superjosereborn
Автор

What are the additional views @10:34 under Test > Windows ?  Running VS2013 Ultimate, I only have "Test Explorer".

robertkerr
Автор

THANK YOU! Great video! Best 10 minutes I've spent all week!

ppardee
Автор

Did I miss the part where it was mentioned that DI was implemented on the business method?

SanjitMisra
Автор

Thanks for explaining in simple way.
Another way is instead of making the function virtual, we can use the NULL design pattern to bypass the objEmail.

SuperSagar
Автор

Absolutely loved the simple and clear explanation !!!

AndroidUmair
Автор

I WANT YOUR HELP TO UNDERSTAND the code. if you are not running your sendemail function how you will know its return true or false, infact you are giving both value for your test and that will never fail as test will never run actual method

aqkhana
Автор

Thanks for presenting this topic in such a simple way...

deepasehgal
Автор

How did .AddCustomer() change to .AddCustomer(MyEmail) ? :)

Mr
Автор

what if the add customer does not receive the email object? 9 out of 10 times you will not pass in an email object when adding a customer... how will you mock then?

chriskim
Автор

Your Assert.AreEqual() is the wrong way round.  It should be Assert.AreEqual(true, IsInserted);

DavidBondOnline
Автор

superb video, thanks for that. i'm new to moq and i got a question, hope you don't mind.
objEmail.Setup(x =>

i tried to let the mock object to return false, but it still passed the test. may i know what is the Returns method for?

thanks and appreciate very much :)

kiamhuh
Автор

What if I use "# If  DEBUG" statement to wrap the Email sending block? In the scale of Performance or architecture what am I violating?

ShawkatOsm
Автор

Thanks really helpful video. Great work sir.

PranitKothari