public void CountIfShouldReturnNbrOfAlphaNumItemsThatMatch() { var func = new CountIf(); var args = FunctionsHelper.CreateArgs(FunctionsHelper.CreateArgs("Monday", "Tuesday", "Thursday"), "T*day"); var result = func.Execute(args, _parsingContext); Assert.AreEqual(2d, result.Result); }
public void CountIfShouldReturnNbrOfNumericItemsThatMatch() { var func = new CountIf(); var args = FunctionsHelper.CreateArgs(FunctionsHelper.CreateArgs(1d, 2d, 3d), ">1"); var result = func.Execute(args, _parsingContext); Assert.AreEqual(2d, result.Result); }
public void CountIfWithInvalidArgumentReturnsPoundValue() { var func = new CountIf(); var parsingContext = ParsingContext.Create(); var args = FunctionsHelper.CreateArgs(); var result = func.Execute(args, parsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void CountIfNonNumeric() { _worksheet.Cells["A1"].Value = "Monday"; _worksheet.Cells["A2"].Value = "Tuesday"; _worksheet.Cells["A3"].Value = "Thursday"; var func = new CountIf(); IRangeInfo range = _provider.GetRange(_worksheet.Name, 1, 1, 3, 1); var args = FunctionsHelper.CreateArgs(range, "T*day"); var result = func.Execute(args, _parsingContext); Assert.AreEqual(2d, result.Result); }
public void CountIfGreaterThanOrEqualToCharacter() { _worksheet.Cells["A1"].Value = null; _worksheet.Cells["A2"].Value = string.Empty; _worksheet.Cells["A3"].Value = "Not Empty"; var func = new CountIf(); IRangeInfo range = _provider.GetRange(_worksheet.Name, 1, 1, 3, 1); var args = FunctionsHelper.CreateArgs(range, ">=a"); var result = func.Execute(args, _parsingContext); Assert.AreEqual(1d, result.Result); }
public void CountIfNumericExpression() { _worksheet.Cells["A1"].Value = null; _worksheet.Cells["A2"].Value = 1d; _worksheet.Cells["A3"].Value = "Not Empty"; var func = new CountIf(); IRangeInfo range = _provider.GetRange(_worksheet.Name, 1, 1, 3, 1); var args = FunctionsHelper.CreateArgs(range, 1d); var result = func.Execute(args, _parsingContext); Assert.AreEqual(1d, result.Result); }
public void CountIfWithCriteriaAsNotEqualToZero() { _worksheet.Cells["A1"].Value = null; _worksheet.Cells["A2"].Value = string.Empty; _worksheet.Cells["A3"].Value = 0d; var func = new CountIf(); IRangeInfo range = _provider.GetRange(_worksheet.Name, 1, 1, 3, 1); var args = FunctionsHelper.CreateArgs(range, "<>0"); var result = func.Execute(args, _parsingContext); Assert.AreEqual(2d, result.Result); }
public void CountIfWithNumbers() { _worksheet.Cells["A1"].Value = 1d; _worksheet.Cells["A2"].Value = 2d; _worksheet.Cells["A3"].Value = 3d; var func = new CountIf(); IRangeInfo range = _provider.GetRange(_worksheet.Name, 1, 1, 3, 1); var args = FunctionsHelper.CreateArgs(range, ">1"); var result = func.Execute(args, _parsingContext); Assert.AreEqual(2d, result.Result); }