Join Bruce Van Horn for an in-depth discussion in this video Testing the simple array class, part of C# Essential Training: 2 Flow Control, Arrays, and Exception Handling.
- [Instructor] We've got our SimpleArray class ready.…Now we just need to write a test for it.…So let's go into Solution Explorer,…find the EssentialTrainingTests project,…right-click it, select Add.…Now you're going to be tempted…to come down here and click Unit Test.…What happens if you do that is…it's going to just generate a file called…Unit Test followed by a number.…In this case, since we already have Unit Test One…it's going to be Unit Test Two.…Generally speaking, that's a bad idea,…you're going to have to go rename the file…so you know what's in it,…and then you're going to have to rename the class…and it's a thing.…
So instead let's go up and select New Item.…Select Test if it's not already there.…Select Basic Unit Test,…now you can actually name the file.…Let's call this SimpleArray Test.…When you're naming your test classes,…generally what you want to do…is you want to name it the same as…the class that you're testing,…in this case that's SimpleArray,…and then just add the word Test onto the end.…That way you know which test…
AuthorBruce Van Horn
- Writing unit tests in C#
- Working with simple and multidimensional arrays
- Managing ordered and unordered data with lists
- Evaluating conditions with if-else statements
- Using OR, AND, and NOT operators
- Building loops
- Debugging and handling exceptions
- Creating the final build of your C# project
Skill Level Beginner
C# Object-Oriented Programming Tips and Trickswith Jesse Freeman58m 39s Intermediate
1. Unit Testing and Test-Driven Development
2. Arrays and Collections
3. Flow Control
4. Exception Handling
5. Getting to Production
Next steps1m 57s
- 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.