public void WhenSourcePropertiesNotSet_ThenSetDefault() { var sut = new TestPerson(); var result = sut.GetPropertiesAsDictionary(BindingFlags.Instance | BindingFlags.Public); Assert.That(result.Count, Is.EqualTo(2)); Assert.That(result["Name"], Is.EqualTo(null)); Assert.That(result["Age"], Is.EqualTo(0)); }
public void WhenSourcePropertiesSet_ThenReturnDictionary() { var sut = new TestPerson { Name = "John", Age = 50 }; var result = sut.GetPropertiesAsDictionary(BindingFlags.Instance | BindingFlags.Public); Assert.That(result.Count, Is.EqualTo(2)); Assert.That(result["Name"], Is.EqualTo("John")); Assert.That(result["Age"], Is.EqualTo(50)); }