public static bool TestGetSimpleRate(MySqlConnection conn) { DataSet MyDataSet = ExcelDataReader.LoadFile("C:/Research/data/test_data/stir_option_rate_test.xlsx"); DataTable MyDataTable = MyDataSet.Tables["All"]; MyDataTable.Columns.Add("int_rate2", typeof(Double)); MyDataTable.Columns.Add("rate_diff", typeof(Double)); foreach (DataRow row in MyDataTable.Rows) { string ExpDate = row.Field <double>("exp_date").ToString(); string Settledate = row.Field <double>("settle_date").ToString(); DateTime ExpDatetime = DateTime.ParseExact(ExpDate, "yyyyMMdd", CultureInfo.InvariantCulture); DateTime SettleDatetime = DateTime.ParseExact(Settledate, "yyyyMMdd", CultureInfo.InvariantCulture); row["int_rate2"] = RateFromStir.GetSimpleRate(SettleDatetime, SettleDatetime, ExpDatetime, "ED", conn); row["rate_diff"] = row.Field <double>("int_rate") - row.Field <double>("int_rate2"); } int NumLargeDiff = MyDataTable.Select("rate_diff>0.0000000001 AND rate_diff<-0.0000000001").Length; if (NumLargeDiff == 0) { return(true); } else { return(false); } }