I am sort of new to TDD. I have started creating the properties I need on the view model as plain auto property.
public string Firstname { get; set; }
Perhaps there is more background to this code that is not being revealed, but what I am seeing seems unnecessarily complicated. Why bother hooking into the RaisePropertyChanged
event at all? Just check the property after setting it.
[TestMethod]
[Tag("Property")]
public void FirstNameTest()
{
var expected = "John";
var sut = new CustomerViewModel();
sut.Firstname = expected;
Assert.AreEqual(expected, sut.Firstname);
}
This also turns the test into a true unit test.