Which unit test should you use?

You are developing an ASP.NET MVC web application that includes the following method.

You need to test the GoldMined method.
Which unit test should you use?

You are developing an ASP.NET MVC web application that includes the following method.

You need to test the GoldMined method.
Which unit test should you use?

A.
Option A

B.
Option B

C.
Option C

D.
Option D



Leave a Reply 2

Your email address will not be published. Required fields are marked *


Axurits

Axurits

I’ll go with C as in D totalGold is defined twice

Sinan Uysal

Sinan Uysal

The method should have the [TestMethod()] attribute, not the [UnitTest()] attribute so C is wrong answer for sure.

There is no IsEqual() assertion so B is also wrong.

IsTrue assertion needs a condition so A is also wrong

D is the correct answer but it contains a typo