public void ConvertFrom_Text_ReturnExpectedClosingStructureInflowModelType(string value, ConfigurationClosingStructureInflowModelType expectedResult) { // Setup var converter = new ConfigurationClosingStructureInflowModelTypeConverter(); // Call object result = converter.ConvertFrom(value); // Assert Assert.AreEqual(expectedResult, result); }
public void ConvertTo_VariousCases_ReturnExpectedText(ConfigurationClosingStructureInflowModelType value, string expectedResult) { // Setup var converter = new ConfigurationClosingStructureInflowModelTypeConverter(); // Call object result = converter.ConvertTo(value, typeof(string)); // Assert Assert.AreEqual(expectedResult, result); }
public void ConvertTo_InvalidClosingStructureInflowModelType_ThrowInvalidEnumArgumentException(Type destinationType) { // Setup var converter = new ConfigurationClosingStructureInflowModelTypeConverter(); const ConfigurationClosingStructureInflowModelType invalidValue = (ConfigurationClosingStructureInflowModelType)99999999; // Call TestDelegate call = () => converter.ConvertTo(invalidValue, destinationType); // Assert string expectedMessage = $"The value of argument 'value' ({invalidValue}) is invalid for Enum type '{nameof(ConfigurationClosingStructureInflowModelType)}'."; string parameterName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage <InvalidEnumArgumentException>(call, expectedMessage).ParamName; Assert.AreEqual("value", parameterName); }