コード例 #1
0
        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}'.*");
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        public void UsageOnNullInstance()
        {
            AttributeHelperTestingObject obj = null;

            obj.GetItemValue("SomeDemo").Should().BeNull();
        }