public void GetValue_WithObjectWithoutPropertyWithName_ThrowsArgumentException()
        {
            // Setup
            var attribute = new KeyValueElementAttribute(nameof(TestObject.Name), "IDoNotExist");

            // Call
            TestDelegate test = () => attribute.GetValue(new TestObject());

            // Assert
            const string expectedMessage = "Value property 'IDoNotExist' was not found on type TestObject.";

            TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentException>(test, expectedMessage);
        }
        public void GetValue_WithObjectWithNonStringProperty_ReturnsStringConvertedValueOfProperty()
        {
            // Setup
            int expectedValue = new Random(21).Next(3, 50);

            var attribute = new KeyValueElementAttribute(nameof(TestObject.NonStringName), nameof(TestObject.NonStringValue));

            // Call
            string value = attribute.GetValue(new TestObject
            {
                NonStringValue = expectedValue
            });

            // Assert
            Assert.AreEqual(Convert.ToString(expectedValue), value);
        }
        public void GetValue_WithObjectWithProperty_ReturnsValueOfProperty()
        {
            // Setup
            const string expectedValue = "expectedValue";

            var attribute = new KeyValueElementAttribute(nameof(TestObject.Name), nameof(TestObject.Value));

            // Call
            string value = attribute.GetValue(new TestObject
            {
                Value = expectedValue
            });

            // Assert
            Assert.AreEqual(expectedValue, value);
        }