Example #1
0
        public void ConvertFrom_InvalidValueType_ThrowsNotSupportedException()
        {
            // Setup
            var invalidValue = new object();
            var converter    = new ConfigurationZoningBoundariesDeterminationTypeConverter();

            // Call
            TestDelegate call = () => converter.ConvertFrom(invalidValue);

            // Assert
            Assert.Throws <NotSupportedException>(call);
        }
Example #2
0
        public void ConvertFrom_VariousCases_ReturnExpecteConfigurationZoningBoundariesDeterminationType(ConfigurationZoningBoundariesDeterminationType expectedResult,
                                                                                                         object value)
        {
            // Setup
            var converter = new ConfigurationZoningBoundariesDeterminationTypeConverter();

            // Call
            object result = converter.ConvertFrom(value);

            // Assert
            Assert.AreEqual(expectedResult, result);
        }
Example #3
0
        public void ConvertFrom_InvalidMacroStabilityInwardsZoningBoundariesDeterminationType_ThrowsInvalidEnumArgumentException()
        {
            // Setup
            const MacroStabilityInwardsZoningBoundariesDeterminationType invalidValue = (MacroStabilityInwardsZoningBoundariesDeterminationType)9999;
            var converter = new ConfigurationZoningBoundariesDeterminationTypeConverter();

            // Call
            TestDelegate call = () => converter.ConvertFrom(invalidValue);

            // Assert
            string expectedMessage = $"The value of argument 'value' ({invalidValue}) is invalid for Enum type '{nameof(MacroStabilityInwardsZoningBoundariesDeterminationType)}'.";
            string parameterName   = TestHelper.AssertThrowsArgumentExceptionAndTestMessage <InvalidEnumArgumentException>(call, expectedMessage).ParamName;

            Assert.AreEqual("value", parameterName);
        }