public void FromCompileResultString() { var compileResult = new CompileResult("abc", DataType.String); var result = new ExpressionConverter().FromCompileResult(compileResult); Assert.IsInstanceOfType(result, typeof(StringExpression)); Assert.AreEqual("abc", result.Compile().Result); }
public void FromCompileResultTimeString() { var compileResult = new CompileResult("1000", DataType.Time); var result = new ExpressionConverter().FromCompileResult(compileResult); Assert.IsInstanceOfType(result, typeof(DecimalExpression)); Assert.AreEqual(1000d, result.Compile().Result); }
public void FromCompileResultDecimalUnknown() { var compileResult = new CompileResult(2.5, DataType.Unknown); var result = new ExpressionConverter().FromCompileResult(compileResult); Assert.IsInstanceOfType(result, typeof(DecimalExpression)); Assert.AreEqual(2.5d, result.Compile().Result); }
public void FromCompileResultIntegerUnknown() { var compileResult = new CompileResult(1, DataType.Unknown); var result = new ExpressionConverter().FromCompileResult(compileResult); Assert.IsInstanceOfType(result, typeof(IntegerExpression)); Assert.AreEqual(1d, result.Compile().Result); }
public void FromCompileResultExcelAddress() { var compileResult = new CompileResult("Sheet1!C3", DataType.ExcelAddress); var result = new ExpressionConverter().FromCompileResult(compileResult); Assert.IsInstanceOfType(result, typeof(StringExpression)); Assert.AreEqual("Sheet1!C3", result.Compile().Result); }
public void FromCompileResultExcelErrorUnknown() { var compileResult = new CompileResult(ExcelErrorValue.Parse("#N/A"), DataType.Unknown); var result = new ExpressionConverter().FromCompileResult(compileResult); Assert.IsInstanceOfType(result, typeof(ExcelErrorExpression)); Assert.AreEqual(ExcelErrorValue.Parse("#N/A"), result.Compile().Result); }
public void FromCompileResultEmpty() { var compileResult = new CompileResult("whatever", DataType.Empty); var result = new ExpressionConverter().FromCompileResult(compileResult); Assert.IsInstanceOfType(result, typeof(IntegerExpression)); Assert.AreEqual(0d, result.Compile().Result); }
public void FromCompileResultErrorTypeEnum() { var compileResult = new CompileResult(eErrorType.Value, DataType.ExcelError); var result = new ExpressionConverter().FromCompileResult(compileResult); Assert.IsInstanceOfType(result, typeof(ExcelErrorExpression)); Assert.AreEqual(ExcelErrorValue.Parse("#VALUE!"), result.Compile().Result); }
public void FromCompileResultDateUnknown() { var compileResult = new CompileResult(DateTime.Parse("1/1/2018"), DataType.Unknown); var result = new ExpressionConverter().FromCompileResult(compileResult); Assert.IsInstanceOfType(result, typeof(DateExpression)); Assert.AreEqual(DateTime.Parse("1/1/2018"), result.Compile().Result); }
public void FromCompileResultDateOADateString() { var compileResult = new CompileResult("12345", DataType.Date); var result = new ExpressionConverter().FromCompileResult(compileResult); Assert.IsInstanceOfType(result, typeof(DateExpression)); Assert.AreEqual(DateTime.Parse("10/18/1933"), result.Compile().Result); }
public void FromCompileResultBooleanUnknown() { var compileResult = new CompileResult(true, DataType.Unknown); var result = new ExpressionConverter().FromCompileResult(compileResult); Assert.IsInstanceOfType(result, typeof(BooleanExpression)); Assert.AreEqual(true, result.Compile().Result); }
public void FromCompileResultBooleanString() { var compileResult = new CompileResult("false", DataType.Boolean); var result = new ExpressionConverter().FromCompileResult(compileResult); Assert.IsInstanceOfType(result, typeof(BooleanExpression)); Assert.AreEqual(false, result.Compile().Result); }
public void FromCompileResultEnumerableListUnknown() { var compileResult = new CompileResult(new List <object> { 1, 2, 3 }, DataType.Unknown); var result = new ExpressionConverter().FromCompileResult(compileResult); Assert.IsInstanceOfType(result, typeof(IntegerExpression)); Assert.AreEqual(1d, result.Compile().Result); }
public void FromCompileResultEnumerableIntegerUnknown() { using (var package = new ExcelPackage()) { var sheet = package.Workbook.Worksheets.Add("Sheet1"); sheet.Cells["C1"].Value = 1; sheet.Cells["C2"].Value = 2; sheet.Cells["C3"].Value = 3; var dataProvider = new EpplusExcelDataProvider(package); var range = dataProvider.GetRange("Sheet1", 1, 3, 3, 3); var compileResult = new CompileResult(range, DataType.Unknown); var result = new ExpressionConverter().FromCompileResult(compileResult); Assert.IsInstanceOfType(result, typeof(IntegerExpression)); Assert.AreEqual(1d, result.Compile().Result); } }