public void DegreesFunctionWithInputZeroRadiansReturnsCorrectResult() { var func = new Degrees(); var args = FunctionsHelper.CreateArgs(0); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(0.0, result.Result); }
public void DegreesFunctionWithTooFewArgumentsReturnsPoundValue() { var func = new Degrees(); var args = FunctionsHelper.CreateArgs(); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void DegreesWithInvalidArgumentReturnsPoundValue() { var func = new Degrees(); var parsingContext = ParsingContext.Create(); var args = FunctionsHelper.CreateArgs(); var result = func.Execute(args, parsingContext); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result.Result).Type); }
public void DegreesFunctionWithNegativeDoubleReturnsCorrectResult() { var func = new Degrees(); var args = FunctionsHelper.CreateArgs(-1.5); var result = func.Execute(args, this.ParsingContext); var roundedResult = System.Math.Round((double)result.Result, 13); Assert.AreEqual(-85.9436692696235, roundedResult); }
public void DegreesFunctionWithNegativeIntegerReturnsCorrectResult() { var func = new Degrees(); var args = FunctionsHelper.CreateArgs(-1); var result = func.Execute(args, this.ParsingContext); var roundedResult = System.Math.Round((double)result.Result, 13); Assert.AreEqual(-57.2957795130823, roundedResult); }
public void DegreesFunctionWithInput2TimesPiRadiansReturnsCorrectResult() { var func = new Degrees(); var pi = System.Math.PI; var args = FunctionsHelper.CreateArgs(2 * pi); var result = func.Execute(args, this.ParsingContext); Assert.AreEqual(360.0, result.Result); }
public void DegreesFunctionWithDateInStringReturnsCorrectResult() { var func = new Degrees(); var args = FunctionsHelper.CreateArgs("6/7/2017"); var result = func.Execute(args, this.ParsingContext); var roundedResult = System.Math.Round((double)result.Result, 8); Assert.AreEqual(2457587.87065464, roundedResult); }
public void DegreesFunctionWithValueGreaterThan2PiReturnsCorrectResult() { var func = new Degrees(); var args = FunctionsHelper.CreateArgs(10); var result = func.Execute(args, this.ParsingContext); var roundedResult = System.Math.Round((double)result.Result, 12); Assert.AreEqual(572.957795130823, roundedResult); }
public void DegreesFunctionWithErrorValuesAsInputReturnsTheInputErrorValue() { var func = new Degrees(); var argNA = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.NA)); var argNAME = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Name)); var argVALUE = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Value)); var argNUM = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Num)); var argDIV0 = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Div0)); var argREF = FunctionsHelper.CreateArgs(ExcelErrorValue.Create(eErrorType.Ref)); var resultNA = func.Execute(argNA, this.ParsingContext); var resultNAME = func.Execute(argNAME, this.ParsingContext); var resultVALUE = func.Execute(argVALUE, this.ParsingContext); var resultNUM = func.Execute(argNUM, this.ParsingContext); var resultDIV0 = func.Execute(argDIV0, this.ParsingContext); var resultREF = func.Execute(argREF, this.ParsingContext); Assert.AreEqual(eErrorType.NA, ((ExcelErrorValue)resultNA.Result).Type); Assert.AreEqual(eErrorType.Name, ((ExcelErrorValue)resultNAME.Result).Type); Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)resultVALUE.Result).Type); Assert.AreEqual(eErrorType.Num, ((ExcelErrorValue)resultNUM.Result).Type); Assert.AreEqual(eErrorType.Div0, ((ExcelErrorValue)resultDIV0.Result).Type); Assert.AreEqual(eErrorType.Ref, ((ExcelErrorValue)resultREF.Result).Type); }