This tutorial builds on the previous video and shows how to use .NET reflection to discover methods decorated with the custom attribute. Then it shows how to invoke those methods atomically and gather the test results and display in the Test Runner UI.
- [Voiceover] My project now has a custom attribute…and I have some tests code here in testing lib…that's choosing that attribute on this three methods.…It's time for me to write some code…that finds all the methods that's marked…with this attribute, instantiates the type…and then runs the code in the test method.…I'll put that code in my Assert method.…I create a method called Get Test Method.…Look at the return value for this method,…it's a list of method info.…
And the reflection apis, method info is a type…that has all the information about the method.…Then I'll call this Get Test Methods…from another method called Run Tests.…The idea is, inside my Assert class,…I have my Observable Collection of Unit Test Info.…I can get that information from this property.…I have a number of different kinds of tests…like Are Equal and is null and is not null,…then I have this method called Get Test.…So the test runner can call Get Test…and it'll do all the work on reflecting all the types…and calling the test methods.…
Now I can go over to my main window…
- Examining types of frameworks
- Choosing a naming convention
- Creating unit tests
- Running unit tests with Visual Studio
- Modifying and correcting code
- Handling exceptions
- Installing and using nUnit
- Viewing test results with CodeLens
Skill Level Intermediate
Q: This course was updated on 08/22/2017. What changed?
A: New videos were added that cover live unit testing and creating a project with the unit test framework.
1. Create a Simple Unit Test Framework
2. Unit Testing Conventions
Choose a naming convention5m 59s
3. Work with Visual Studio Unit Testing Framework
4. Work with xUnit
5. Work with nUnit
6. Additional Topics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.