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

Unit testing static classes - C# Tutorial

From the course: C# Best Practices for Developers

Start my 1-month free trial

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…

Contents