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 without parameters - C# Tutorial
From the course: C# Best Practices for Developers
Unit testing without parameters
- [Instructor] OK, so we are ready to create our test. Let's go ahead and hop on over to our actor test, but, before we do, I'm gonna copy this line, here, booking can change if actor starts trouble, because I'll be using that line. And, in our test file, our first test method will be for booking the actor without any specific date. So, we're not returning anything. The name is BookActor, but let's call this TestBookActor, and follow the convention. All your tests should indicate that you're testing, just to be consistent. And, we will be arranging our details. And, we know we will Act and Assert, so I'll just put those in, right now. But, we're not done arranging, yet. I'm going to use the variable currentActor and create a new instance. And, we're going to be passing in the actor name. And, for expected, we want the statement to say Actor Johnny Boy is booked, followed by details, indicating that, if he starts any problem, he's out. And, to get our result, I specify the…
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)
Method overloading5m 16s
-
(Locked)
Unit testing without parameters4m 5s
-
(Locked)
Unit testing with parameters2m 54s
-
(Locked)
Method chaining4m 7s
-
(Locked)
Constants vs. read-only fields5m 28s
-
(Locked)
Using properties correctly2m 11s
-
(Locked)
Using properties demo4m 29s
-
(Locked)
Auto-implemented properties1m 33s
-
(Locked)
Auto-implemented properties demo5m 13s
-
(Locked)
-
-
-