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.
Unit testing static classes - C# Tutorial
From the course: C# Best Practices for Developers
Unit testing static classes
- So, we are ready to test our notification service. So, to do so, let's create our test project for this purpose. Right-click on Test, New Project, and we'll make sure to reselect Test on the left-hand side, and we'll call this Prestige.CommonTests. Okay, double check that it's right in the Test folder, and it seems that it is. Let's rename this UniTest to NotificationServiceTest. Should I update my class name? Yes. Now, let me go ahead and save this, Ctrl-S, and before we move any further, we want to be able to set a reference to the project that we're going to be using. That is Prestige.Common. And now, we can create our TestMethod. TestNotifyTalent. And when we are arranging, we'll expect, and let me go ahead and take a look to see what we wrote, talent, colon, space, and then the talent name. Now, to make this a little bit more specific to what we're actually doing, it really should say something like Notifying talent, and then it'll have this talent name. So, I'll save that, 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)
-
-
-
-