From the course: C# Best Practices for Developers

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Auto-implemented properties demo

Auto-implemented properties demo - C# Tutorial

From the course: C# Best Practices for Developers

Start my 1-month free trial

Auto-implemented properties demo

- [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…

Contents