Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7645779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:01:50+00:00 2026-05-31T10:01:50+00:00

I am a beginner at TDD, and something I am trying to figure is

  • 0

I am a “beginner” at TDD, and something I am trying to figure is how to unit test viewmodels…

I am wanting to make sure that a property ProeprtyChanged event is fired… I have the following test using nunit.

[Test]        
public void Radius_Property_Changed()
{
    var result = false;
    var sut = new MainViewModel();
    sut.PropertyChanged += (s, e) =>
    {
        if (e.PropertyName == "Radius")
        {
            result = true;
        }
    };

    sut.Radius = decimal.MaxValue;
    Assert.That(result, Is.EqualTo(true));
}

Is this the cleanest way to do this, or is there a better way to test this property

… snippet of code in the viewmodel of the propety I am testing looks like this…

public decimal Radius
{
    get { return _radius; }
    set
    {
        _radius = value;
        OnPropertyChanged("Radius");
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:01:52+00:00Added an answer on May 31, 2026 at 10:01 am

    This is pretty much how you do that. There’s not much else to do here given it’s pretty simple (and boring) code. It might be worth to wrap that in your own reusable library/tool. Or even better, use existing code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Beginner question here. I'm going to make a Jquery function that is used to
Beginner here! I am trying to write a query that will select the 3
Beginner here trying to get a pipeline working in bash. If somebody can see
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
Im a beginner when it comes to TDD and BDD. This is what I
Beginner programmer here....hope it makes sense :) I have created a console app that
Beginner at Django here, I've been trying to fix this for a long time
Total beginner with PHP: I have an form based on table data that the
A beginner question I am sure, but I have just started working with a
Python beginner here. I am using the matplotlib library to make graphs from tab

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.