public void ConvertFrom_InvalidType_ThrowNotSupportedException() { // Setup var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter(); // Call TestDelegate call = () => converter.ConvertFrom(new object()); // Assert Assert.Throws <NotSupportedException>(call); }
public void ConvertFrom_Text_ReturnExpectedConfigurationStabilityPointStructuresLoadSchematizationType(string value, ConfigurationStabilityPointStructuresLoadSchematizationType expectedResult) { // Setup var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter(); // Call object result = converter.ConvertFrom(value); // Assert Assert.AreEqual(expectedResult, result); }
public void ConvertFrom_InvalidText_ThrowNotSupportedException() { // Setup var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter(); 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_InvalidLoadSchematizationType_ThrowInvalidEnumArgumentException() { // Setup var converter = new ConfigurationStabilityPointStructuresLoadSchematizationTypeConverter(); const LoadSchematizationType invalidValue = (LoadSchematizationType)983; // Call TestDelegate call = () => converter.ConvertFrom(invalidValue); // Assert string expectedMessage = $"The value of argument 'value' ({invalidValue}) is invalid for Enum type '{nameof(LoadSchematizationType)}'."; string parameterName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage <InvalidEnumArgumentException>(call, expectedMessage).ParamName; Assert.AreEqual("value", parameterName); }