Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Shadowing attribute that the VS uses when it generates unit tests?

When i generated unit tests the Visual studio added some fictive class that mocks my class and added the "Shadowing" attribute. What does it do?

like image 722
Adibe7 Avatar asked Aug 09 '10 20:08

Adibe7


People also ask

Which attribute is used to denote a class that contains unit tests?

The TestClass attribute denotes a class that contains unit tests. The TestMethod attribute indicates a method is a test method.

Which attribute is used to mark the test class in the end unit?

Every test class must have the TestClass attribute, and every test method must have the TestMethod attribute.

What are the three sections within a unit test?

A unit test typically features three different phases: Arrange, Act, and Assert (sometimes referred to as AAA). For a unit test to be successful, the resulting behavior in all three phases must be in line with expectations.

What is functional testing VS unit testing?

Unit testing and Functional testing are the foundation of the testing process. The main difference is between the two is: Unit testing is performed by the developer during the development cycle, and. Functional testing is performed by the tester during the level of system testing.


Video Answer


1 Answers

Did some research and found this. Apparantly, the [Shadowing] attribute is used by MSTest when it creates an accessor class that allows you to call a private method on a class as if it were public.

So when you're unit testing a private method of a target class, that private method will be available to you via the accessor wrapper class for the target class.

like image 147
Jason Evans Avatar answered Oct 20 '22 19:10

Jason Evans