Ejemplo n.º 1
0
        public void Parse_ValueIsPocketGuagerNullValue_ReturnsNull()
        {
            const string pocketGuagerNullValue = "-999999999.999";

            var result = DoubleHelper.Parse(pocketGuagerNullValue);

            Assert.That(result, Is.EqualTo(null));
        }
Ejemplo n.º 2
0
        public void Parse_ValidDoubleString_ReturnsExpectedValue(Tuple <string, double> testCases)
        {
            var value    = testCases.Item1;
            var expected = testCases.Item2;

            var result = DoubleHelper.Parse(value);

            Assert.That(result, Is.EqualTo(expected));
        }
Ejemplo n.º 3
0
        public void Parse_NonDoubleString_ReturnsNull()
        {
            var result = DoubleHelper.Parse(_fixture.Create <string>());

            Assert.That(result, Is.Null);
        }
Ejemplo n.º 4
0
        public void Parse_NullString_ReturnsNull()
        {
            var result = DoubleHelper.Parse(null);

            Assert.That(result, Is.Null);
        }
Ejemplo n.º 5
0
        private void BindFractionDropDowns()
        {
            var fractions = new Collection <ListItem>();

            for (int fractionValue = -100; fractionValue <= 100; fractionValue += 5)
            {
                fractions.Add(new ListItem(fractionValue.ToString()));
            }

            fractions.Add(new ListItem("11,111"));
            fractions.Add(new ListItem("12,5"));
            fractions.Add(new ListItem("14,2857"));
            fractions.Add(new ListItem("16,666"));
            fractions.Add(new ListItem("33,333"));
            fractions.Add(new ListItem("66,666"));
            fractions.Add(new ListItem("83,333"));
            fractions.Add(new ListItem("-11,111"));
            fractions.Add(new ListItem("-12,5"));
            fractions.Add(new ListItem("-14,2857"));
            fractions.Add(new ListItem("-16,666"));
            fractions.Add(new ListItem("-33,333"));
            fractions.Add(new ListItem("-66,666"));
            fractions.Add(new ListItem("-83,333"));

            foreach (var control in _answerControls)
            {
                control.FractionDropDownDataSource = fractions.OrderByDescending(item => DoubleHelper.Parse(item.Text));
                control.DataBind();
            }
        }
Ejemplo n.º 6
0
        private static bool IsCrossSectionPointData(string line)
        {
            var lineTokens = line.Split(CrossSectionPointDataSeparator.ToCharArray());

            return(DoubleHelper.Parse(lineTokens.FirstOrDefault()).HasValue);
        }