public void IfErrorWithErrorAndNullArgumentReturnsCorrectResult() { var function = new IfError(); var arguments = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Name), null); var result = function.Execute(arguments, this.ParsingContext); Assert.AreEqual(0, result.Result); }
public void IfErrorWithErrorAndEmptyStringReturnsCorrectResult() { var function = new IfError(); var arguments = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Div0), string.Empty); var result = function.Execute(arguments, this.ParsingContext); Assert.AreEqual(string.Empty, result.Result); }
public void IfErrorWithNoErrorReturnsCorrectResult() { var function = new IfError(); var arguments = FunctionsHelper.CreateArgs(1, "word"); var result = function.Execute(arguments, this.ParsingContext); Assert.AreEqual(1, result.Result); }
public void IfErrorWithTooFewArgumentsReturnsPoundValue() { var function = new IfError(); var arguments = FunctionsHelper.CreateArgs(); var result = function.Execute(arguments, this.ParsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void IfErrorWithStringAndErrorReturnsCorrectResult() { var function = new IfError(); var arguments = FunctionsHelper.CreateArgs("word", ExcelErrorValue.Create(eErrorType.Num)); var result = function.Execute(arguments, this.ParsingContext); Assert.AreEqual("word", result.Result); }
public void IfErrorWithErrorValuesAsInputReturnsCorrectResults() { var function = new IfError(); var argumentsNA = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.NA), 1); var argumentsNAME = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Name), 1); var argumentsVALUE = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Value), 1); var argumentsNUM = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Num), 1); var argumentsDIV0 = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Div0), 1); var argumentsREF = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Ref), 1); var resultNA = function.Execute(argumentsNA, this.ParsingContext); var resultNAME = function.Execute(argumentsNAME, this.ParsingContext); var resultVALUE = function.Execute(argumentsVALUE, this.ParsingContext); var resultNUM = function.Execute(argumentsNUM, this.ParsingContext); var resultDIV0 = function.Execute(argumentsDIV0, this.ParsingContext); var resultREF = function.Execute(argumentsREF, this.ParsingContext); Assert.AreEqual(1, resultNA.Result); Assert.AreEqual(1, resultNAME.Result); Assert.AreEqual(1, resultVALUE.Result); Assert.AreEqual(1, resultNUM.Result); Assert.AreEqual(1, resultDIV0.Result); Assert.AreEqual(1, resultREF.Result); }