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 with parameters - C# Tutorial
From the course: C# Best Practices for Developers
Unit testing with parameters
- [Instructor] So we're ready to create our second test method. Before I do, let me go ahead and closeout these other files that we don't need. And I will copy line 33 through 45, and paste. And let's modify this. On specific date. Now, the next line that we're going to want to change is actor Johnny Boy is booked. And we'll indicate on. And we'll use date time for today, and convert it to a string, specifically a short date string. And concatenate that, and add a period along with the details. And this time for act we are going to pass in the date, because if we recall we have our date string parameter that we can pass in. So I'll right-click on our test, and run, and see if we pass. And it does. So let's go ahead and summarize our best practices as it relates to overloading. You want to include comments when it's necessary, when you feel that it's needed, and it adds a value. Something else to keep in mind is to not use too many parameters. We didn't pass like seven or eight…
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)
-
-
-