public void UsageOnInvalidPropertyName(string propertyName) { AttributeHelperTestingObject obj = new AttributeHelperTestingObject(); Action act = () => obj.GetItemValue(propertyName); act.ShouldThrowExactly <ArgumentException>().WithMessage($"Item doesn't contain property named: '{propertyName}'.*"); }
public void UsageOnValidPropertyName(string propertyName) { AttributeHelperTestingObject obj = new AttributeHelperTestingObject() { DateTime = DateTime.Now, Integer = 100, String = "merkkijono", NullableInteger = 10, SomeDemo = new SomeDemoObject() { Integer = 1, String = "ptv" } }; // assume we get a non null value always, datetime and integer are boxed obj.GetItemValue(propertyName).Should().NotBeNull(); }
public void UsageOnNullInstance() { AttributeHelperTestingObject obj = null; obj.GetItemValue("SomeDemo").Should().BeNull(); }