public void ConvertFrom_InvalidType_ThrowNotSupportedException() { // Setup var converter = new ConfigurationStabilityPointStructuresInflowModelTypeConverter(); // Call TestDelegate call = () => converter.ConvertFrom(new object()); // Assert Assert.Throws <NotSupportedException>(call); }
public void ConvertFrom_StabilityPointStructureInflowModelType_ReturnExpectedConfigurationInflowModelType(StabilityPointStructureInflowModelType value, ConfigurationStabilityPointStructuresInflowModelType expectedResult) { // Setup var converter = new ConfigurationStabilityPointStructuresInflowModelTypeConverter(); // Call object result = converter.ConvertFrom(value); // Assert Assert.AreEqual(expectedResult, result); }
public void ConvertFrom_InvalidText_ThrowNotSupportedException() { // Setup var converter = new ConfigurationStabilityPointStructuresInflowModelTypeConverter(); const string invalidValue = "some text"; // Call TestDelegate call = () => converter.ConvertFrom(invalidValue); // Assert string message = Assert.Throws <NotSupportedException>(call).Message; Assert.AreEqual($"Value '{invalidValue}' is not supported.", message); }
public void ConvertFrom_InvalidStabilityPointStructureInflowModelType_ThrowInvalidEnumArgumentException() { // Setup var converter = new ConfigurationStabilityPointStructuresInflowModelTypeConverter(); const StabilityPointStructureInflowModelType invalidValue = (StabilityPointStructureInflowModelType)983; // Call TestDelegate call = () => converter.ConvertFrom(invalidValue); // Assert string expectedMessage = $"The value of argument 'value' ({invalidValue}) is invalid for Enum type '{nameof(StabilityPointStructureInflowModelType)}'."; string parameterName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage <InvalidEnumArgumentException>(call, expectedMessage).ParamName; Assert.AreEqual("value", parameterName); }