コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }