public void Parse_ValueIsPocketGuagerNullValue_ReturnsNull() { const string pocketGuagerNullValue = "-999999999.999"; var result = DoubleHelper.Parse(pocketGuagerNullValue); Assert.That(result, Is.EqualTo(null)); }
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)); }
public void Parse_NonDoubleString_ReturnsNull() { var result = DoubleHelper.Parse(_fixture.Create <string>()); Assert.That(result, Is.Null); }
public void Parse_NullString_ReturnsNull() { var result = DoubleHelper.Parse(null); Assert.That(result, Is.Null); }
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(); } }
private static bool IsCrossSectionPointData(string line) { var lineTokens = line.Split(CrossSectionPointDataSeparator.ToCharArray()); return(DoubleHelper.Parse(lineTokens.FirstOrDefault()).HasValue); }