From the course: C# Best Practices for Developers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Running a unit test - C# Tutorial
From the course: C# Best Practices for Developers
Running a unit test
- [Narrator] Now I'll go to our unit test. And let's rename this UnitTest to ActorTest. When I hit enter, it'll ask me if I want to go ahead and rename my class, and I'll say yes to that. And you can see Visual Studio nicely does that. And our next step should be to add a reference to our project that we're going to be referencing the class from. So by right clicking on reference, I'll go ahead and choose projects, and now I'll have my option for Prestige.biz. Click OK here. And let's go ahead and rename this method to TestGetOccupation. And there's going to be three steps. If you're familiar with test-driven development, there's arrange, act, and assert. And again, I go into detail on this in my test-driven development course. So for arrangement, we'll have our current Actor. And create a new instance. By holding the control key down and period, I'm able to select the name space using Prestige.biz. And now it'll recognize Actor. Now the expected result that we want is Actor. And…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Project setup overview1m 13s
-
(Locked)
Set up the business layer2m 18s
-
(Locked)
Running a unit test3m 13s
-
Class naming conventions and standards5m 2s
-
(Locked)
Field and property naming conventions4m 22s
-
(Locked)
Using constructors3m 9s
-
(Locked)
Unit testing constructors4m 30s
-
(Locked)
Namespaces2m 48s
-
(Locked)
Static classes3m 10s
-
(Locked)
Unit testing static classes4m 20s
-
(Locked)
Using a singleton2m 6s
-
(Locked)
-
-
-
-