public void GetValue_InvalidValueProperty_ThrowsArgumentException()
        {
            // Setup
            var attribute = new KeyValueAsRoundedDoubleWithoutTrailingZeroesElementAttribute(nameof(TestObject.Name),
                                                                                             nameof(TestObject.Unit),
                                                                                             "IDoNotExist");

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

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

            TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentException>(Call, expectedMessage);
        }
        public void GetValue_WithObjectWithRoundedDoubleProperty_ReturnsValueOfPropertyWithoutTrailingZeroes(double doubleValue, string expectedResult)
        {
            // Setup
            var roundedDoubleValue = new RoundedDouble(5, doubleValue);
            var attribute          = new KeyValueAsRoundedDoubleWithoutTrailingZeroesElementAttribute(nameof(TestObject.Name),
                                                                                                      nameof(TestObject.Unit),
                                                                                                      nameof(TestObject.Value));

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

            // Assert
            Assert.AreEqual(expectedResult, value);
        }
        public void GetValue_WithObjectWithNonStringProperty_ThrowsArgumentException()
        {
            // Setup
            int expectedValue = new Random(21).Next(3, 50);

            var attribute = new KeyValueAsRoundedDoubleWithoutTrailingZeroesElementAttribute(nameof(TestObject.Name),
                                                                                             nameof(TestObject.Unit),
                                                                                             nameof(TestObject.NonRoundedDoubleValue));

            // Call
            void Call() =>
            attribute.GetValue(new TestObject
            {
                NonRoundedDoubleValue = expectedValue
            });

            // Assert
            const string expectedMessage = "Value property 'NonRoundedDoubleValue' was not of type RoundedDouble.";

            TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentException>(Call, expectedMessage);
        }