Join Reynald Adolphe for an in-depth discussion in this video Auto-implemented properties demo, part of C# Best Practices for Developers.
- [Instructor] Okay, so we're ready to create…our test methods.…Let's go onto our ActorTest file.…And I will go ahead and just copy and paste…our last TestMethod…and modify this for our specific purpose right now.…I'll give it the name of TestAutoProp,…short for property, ActorDescription.…
And let's clear out what we have in Act and Arrange.…And we'll go ahead and create the method stub…for our next test,…which will test AutoPropInit, for the initializer,…ActorAge.…We'll comment this out for now.…
For our first test, we'll create our currentActor.…That is going to be a new instance…of an Actor.…And we'll be initializing the ActorName…as Sandy Love.…
Our expected value…is she's going to be a regular actor.…That's our description.…And for the result,…we will invoke ActorDescription.…All right, moving on to our second test.…We'll uncomment that.…
And here,…I'll jump to line 83, copy what we have.…And the only difference that I'm going to add,…after I paste in, is specify her age.…Which actually, as we can see here, is a typo.…
- Naming and handling classes
- Running a unit test
- Using constructors
- Naming and handling methods, fields, and properties
- Using properties correctly
- Managing objects efficiently
- Common design patterns as best practices
Skill Level Intermediate
1. Best Practices: An Overview
2. Naming and Handling Classes
3. Naming and Handling Methods, Fields, and Properties
4. Managing Objects Efficiently
5. More Best Practices Resources
- 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.