Exemple #1
0
        private static void TestParameterIs(IntegerParameter p, int val)
        {
            Assert.That(p.Value, Is.EqualTo(val));
            int  result;
            bool isInt;

            Assert.That(p.Corrupted, Is.False);
            Assert.That(p.ValueAsString(), Is.EqualTo(val.ToString(CultureInfo.InvariantCulture))); //Tempting to simply verify it will parse as the correct value but we need to be consistent with existing files
            using (TemporaryCulture.English())
            {
                isInt = int.TryParse(p.DisplayValue((a, b) => ""), out result);
                Assert.That(isInt);
                if (isInt)
                {
                    Assert.That(result, Is.EqualTo(val));
                }
            }
            using (TemporaryCulture.European())
            {
                isInt = int.TryParse(p.DisplayValue((a, b) => ""), out result);
                Assert.That(isInt);
                if (isInt)
                {
                    Assert.That(result, Is.EqualTo(val));
                }
            }
        }
Exemple #2
0
 private static void TestCorruptParameter(IntegerParameter p, string valueAsString)
 {
     Assert.That(p.Corrupted, Is.True);
     Assert.That(p.ValueAsString(), Is.EqualTo(valueAsString));
 }