public void TestFloatBackCoverterForIllegal(string inputValue, string format) { var varInfo = new FloatVariableInfo(); varInfo.FormatSelectedItem = format; var wVal = varInfo.Value; try { wVal.ConvertBack(inputValue); Assert.Fail("Exception did not occur"); } catch (OverflowException) { Assert.IsTrue(true); } catch (FormatException) { Assert.IsTrue(true); } catch (Exception e) { Assert.Fail(e.Message); } }
public void TestFloatBackCoverter(string inputValue, string format, float expectedDisplayValue) { var varInfo = new FloatVariableInfo(); varInfo.FormatSelectedItem = format; var wVal = varInfo.Value; var convVal = (WrappedValue <float>)wVal.ConvertBack(inputValue); Assert.AreEqual(convVal.Value, expectedDisplayValue); }
public void TestFloatCoverter(float inputValue, string format, string expectedDisplayValue) { var varInfo = new FloatVariableInfo(); varInfo.FormatSelectedItem = format; var wVal = varInfo.Value; wVal.Value = inputValue; var convVal = wVal.Convert(); Assert.AreEqual(convVal, expectedDisplayValue); }