public void ConvertFrom_InvalidValueType_ThrowsNotSupportedException() { // Setup var invalidValue = new object(); var converter = new ConfigurationDikeSoilScenarioTypeConverter(); // Call TestDelegate call = () => converter.ConvertFrom(invalidValue); // Assert Assert.Throws <NotSupportedException>(call); }
public void ConvertFrom_VariousCases_ReturnExpectedConfigurationDikeSoilScenario(ConfigurationDikeSoilScenario expectedResult, object value) { // Setup var converter = new ConfigurationDikeSoilScenarioTypeConverter(); // Call object result = converter.ConvertFrom(value); // Assert Assert.AreEqual(expectedResult, result); }
public void ConvertFrom_InvalidMacroStabilityInwardsDikeSoilScenario_ThrowsInvalidEnumArgumentException() { // Setup const MacroStabilityInwardsDikeSoilScenario invalidValue = (MacroStabilityInwardsDikeSoilScenario)9999; var converter = new ConfigurationDikeSoilScenarioTypeConverter(); // Call TestDelegate call = () => converter.ConvertFrom(invalidValue); // Assert string expectedMessage = $"The value of argument 'value' ({invalidValue}) is invalid for Enum type '{nameof(MacroStabilityInwardsDikeSoilScenario)}'."; string parameterName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage <InvalidEnumArgumentException>(call, expectedMessage).ParamName; Assert.AreEqual("value", parameterName); }