Here are the examples of the csharp api class NUnit.Framework.Assert.AreEqual(double, double, double) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
200 Examples
0
1. Example
View license[Test,ExpectedException(typeof(AssertionException))] public void EqualsNaNFails() { expectedMessage = " Expected: 1.234d +/- 0.0d" + Environment.NewLine + " But was: NaN" + Environment.NewLine; Assert.AreEqual(1.234, Double.NaN, 0.0); }
0
2. Example
View license[Test] [ExpectedException(typeof(AssertionException))] public void NanEqualsFails() { expectedMessage = " Expected: NaN" + Environment.NewLine + " But was: 1.234d" + Environment.NewLine; Assert.AreEqual(Double.NaN, 1.234, 0.0); }
0
3. Example
View license[Test] public void NanEqualsNaNSucceeds() { Assert.AreEqual(Double.NaN, Double.NaN, 0.0); }
0
4. Example
View license[Test] public void NegInfinityEqualsInfinity() { Assert.AreEqual(Double.NegativeInfinity, Double.NegativeInfinity, 0.0); }
0
5. Example
View license[Test] public void PosInfinityEqualsInfinity() { Assert.AreEqual(Double.PositiveInfinity, Double.PositiveInfinity, 0.0); }
0
6. Example
View license[Test,ExpectedException(typeof(AssertionException))] public void PosInfinityNotEquals() { expectedMessage = " Expected: Infinity" + Environment.NewLine + " But was: 1.23d" + Environment.NewLine; Assert.AreEqual(Double.PositiveInfinity, 1.23, 0.0); }
0
7. Example
View license[Test,ExpectedException(typeof(AssertionException))] public void PosInfinityNotEqualsNegInfinity() { expectedMessage = " Expected: Infinity" + Environment.NewLine + " But was: -Infinity" + Environment.NewLine; Assert.AreEqual(Double.PositiveInfinity, Double.NegativeInfinity, 0.0); }
0
8. Example
View license[Test,ExpectedException(typeof(AssertionException))] public void SinglePosInfinityNotEqualsNegInfinity() { expectedMessage = " Expected: Infinity" + Environment.NewLine + " But was: -Infinity" + Environment.NewLine; Assert.AreEqual(float.PositiveInfinity, float.NegativeInfinity, (float)0.0); }
0
9. Example
View license[TestCase(3.7, 2, 5.7)] public void TestMethodWithConvertibleArguments(double x, double y, double sum) { Assert.AreEqual(sum, x + y, 0.0001); }
0
10. Example
View license[TestCase(3.7, 2, 5.7)] public void TestMethodWithNonConvertibleArguments(int x, int y, int sum) { Assert.AreEqual(sum, x + y, 0.0001); }
0
11. Example
View license[Test,ExpectedException(typeof(AssertionException))] public void EqualsNaNFails() { expectedMessage = " Expected: 1.234d +/- 0.0d" + Environment.NewLine + " But was: NaN" + Environment.NewLine; Assert.AreEqual(1.234, Double.NaN, 0.0); }
0
12. Example
View license[Test] [ExpectedException(typeof(AssertionException))] public void NanEqualsFails() { expectedMessage = " Expected: NaN" + Environment.NewLine + " But was: 1.234d" + Environment.NewLine; Assert.AreEqual(Double.NaN, 1.234, 0.0); }
0
13. Example
View license[Test] public void NanEqualsNaNSucceeds() { Assert.AreEqual(Double.NaN, Double.NaN, 0.0); }
0
14. Example
View license[Test] public void NegInfinityEqualsInfinity() { Assert.AreEqual(Double.NegativeInfinity, Double.NegativeInfinity, 0.0); }
0
15. Example
View license[Test] public void PosInfinityEqualsInfinity() { Assert.AreEqual(Double.PositiveInfinity, Double.PositiveInfinity, 0.0); }
0
16. Example
View license[Test,ExpectedException(typeof(AssertionException))] public void PosInfinityNotEquals() { expectedMessage = " Expected: Infinity" + Environment.NewLine + " But was: 1.23d" + Environment.NewLine; Assert.AreEqual(Double.PositiveInfinity, 1.23, 0.0); }
0
17. Example
View license[Test,ExpectedException(typeof(AssertionException))] public void PosInfinityNotEqualsNegInfinity() { expectedMessage = " Expected: Infinity" + Environment.NewLine + " But was: -Infinity" + Environment.NewLine; Assert.AreEqual(Double.PositiveInfinity, Double.NegativeInfinity, 0.0); }
0
18. Example
View license[Test,ExpectedException(typeof(AssertionException))] public void SinglePosInfinityNotEqualsNegInfinity() { expectedMessage = " Expected: Infinity" + Environment.NewLine + " But was: -Infinity" + Environment.NewLine; Assert.AreEqual(float.PositiveInfinity, float.NegativeInfinity, (float)0.0); }
0
19. Example
View license[TestCase(3.7, 2, 5.7)] public void TestMethodWithConvertibleArguments(double x, double y, double sum) { Assert.AreEqual(sum, x + y, 0.0001); }
0
20. Example
View license[TestCase(3.7, 2, 5.7)] public void TestMethodWithNonConvertibleArguments(int x, int y, int sum) { Assert.AreEqual(sum, x + y, 0.0001); }
0
21. Example
View license[Test,ExpectedException(typeof(AssertionException))] public void EqualsNaNFails() { expectedMessage = " Expected: 1.234d +/- 0.0d" + Environment.NewLine + " But was: NaN" + Environment.NewLine; Assert.AreEqual(1.234, Double.NaN, 0.0); }
0
22. Example
View license[Test] [ExpectedException(typeof(AssertionException))] public void NanEqualsFails() { expectedMessage = " Expected: NaN" + Environment.NewLine + " But was: 1.234d" + Environment.NewLine; Assert.AreEqual(Double.NaN, 1.234, 0.0); }
0
23. Example
View license[Test] public void NanEqualsNaNSucceeds() { Assert.AreEqual(Double.NaN, Double.NaN, 0.0); }
0
24. Example
View license[Test] public void NegInfinityEqualsInfinity() { Assert.AreEqual(Double.NegativeInfinity, Double.NegativeInfinity, 0.0); }
0
25. Example
View license[Test] public void PosInfinityEqualsInfinity() { Assert.AreEqual(Double.PositiveInfinity, Double.PositiveInfinity, 0.0); }
0
26. Example
View license[Test,ExpectedException(typeof(AssertionException))] public void PosInfinityNotEquals() { expectedMessage = " Expected: Infinity" + Environment.NewLine + " But was: 1.23d" + Environment.NewLine; Assert.AreEqual(Double.PositiveInfinity, 1.23, 0.0); }
0
27. Example
View license[Test,ExpectedException(typeof(AssertionException))] public void PosInfinityNotEqualsNegInfinity() { expectedMessage = " Expected: Infinity" + Environment.NewLine + " But was: -Infinity" + Environment.NewLine; Assert.AreEqual(Double.PositiveInfinity, Double.NegativeInfinity, 0.0); }
0
28. Example
View license[Test,ExpectedException(typeof(AssertionException))] public void SinglePosInfinityNotEqualsNegInfinity() { expectedMessage = " Expected: Infinity" + Environment.NewLine + " But was: -Infinity" + Environment.NewLine; Assert.AreEqual(float.PositiveInfinity, float.NegativeInfinity, (float)0.0); }
0
29. Example
View license[TestCase(3.7, 2, 5.7)] public void TestMethodWithConvertibleArguments(double x, double y, double sum) { Assert.AreEqual(sum, x + y, 0.0001); }
0
30. Example
View license[TestCase(3.7, 2, 5.7)] public void TestMethodWithNonConvertibleArguments(int x, int y, int sum) { Assert.AreEqual(sum, x + y, 0.0001); }
0
31. Example
View license[Test] public void WhenRadiateIsTrue_HeadingIsEqualToNormalizedOffset() { var subject = new RingProfile { Radius = 10f, Radiate = Profile.CircleRadiation.Out }; Vector2 offset, heading; subject.GetOffsetAndHeading(out offset, out heading); Assert.AreEqual(heading.X, offset.X / 10, 0.000001); Assert.AreEqual(heading.Y, offset.Y / 10, 0.000001); }
0
32. Example
View licensepublic static void AreEqual(Vector3 a, Vector3 b, double delta) { Assert.AreEqual(a.X, b.X, delta); Assert.AreEqual(a.Y, b.Y, delta); Assert.AreEqual(a.Z, b.Z, delta); }
0
33. Example
View license[Test] public void DivisionOperator_DivideGenericSameQuantity_ReturnsScalar() { var expected = 1.0; var numerator = new Area(500.0, Area.SquareCentiMeter); var denominator = new Area(5.0, Area.SquareDeciMeter); var actual = (double)(numerator / denominator); Assert.AreEqual(expected, actual, 1.0e-6); }
0
34. Example
View license[Test] public void TestGetAnchorHeightInPoints() { HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = (HSSFSheet)wb.CreateSheet("Test"); HSSFClientAnchor a = new HSSFClientAnchor(0, 0, 1023, 255, (short)0, 0, (short)0, 0); float p = a.GetAnchorHeightInPoints(sheet); Assert.AreEqual(12.7, p, 0.001); sheet.CreateRow(0).HeightInPoints = (14); a = new HSSFClientAnchor(0, 0, 1023, 255, (short)0, 0, (short)0, 0); p = a.GetAnchorHeightInPoints(sheet); Assert.AreEqual(13.945, p, 0.001); a = new HSSFClientAnchor(0, 0, 1023, 127, (short)0, 0, (short)0, 0); p = a.GetAnchorHeightInPoints(sheet); Assert.AreEqual(6.945, p, 0.001); a = new HSSFClientAnchor(0, 126, 1023, 127, (short)0, 0, (short)0, 0); p = a.GetAnchorHeightInPoints(sheet); Assert.AreEqual(0.054, p, 0.001); a = new HSSFClientAnchor(0, 0, 1023, 0, (short)0, 0, (short)0, 1); p = a.GetAnchorHeightInPoints(sheet); Assert.AreEqual(14.0, p, 0.001); sheet.CreateRow(0).HeightInPoints = (12); a = new HSSFClientAnchor(0, 127, 1023, 127, (short)0, 0, (short)0, 1); p = a.GetAnchorHeightInPoints(sheet); Assert.AreEqual(12.372, p, 0.001); }
0
35. Example
View license[Test] public void TestAnchorHeightInPoints() { HSSFWorkbook wb = new HSSFWorkbook(); NPOI.SS.UserModel.ISheet sheet = wb.CreateSheet(); HSSFClientAnchor[] anchor = { new HSSFClientAnchor( 0 , 0, 0 , 0 ,(short)0, 1,(short)1, 3), new HSSFClientAnchor( 0 , 254 , 0 , 126 ,(short)0, 1,(short)1, 3), new HSSFClientAnchor( 0 , 128 , 0 , 128 ,(short)0, 1,(short)1, 3), new HSSFClientAnchor( 0 , 0 , 0 , 128 ,(short)0, 1,(short)1, 3), }; float[] ref1 = { 25.5f, 19.125f, 25.5f, 31.875f }; for (int i = 0; i < anchor.Length; i++) { float height = anchor[i].GetAnchorHeightInPoints(sheet); Assert.AreEqual(ref1[i], height, 0); } }
0
36. Example
View licenseprivate static void Confirm(ValueEval arg0, ValueEval arg1, double expectedResult) { ValueEval[] args = { arg0, arg1, }; double result = NumericFunctionInvoker.Invoke(EvalInstances.Divide, args, 0, 0); Assert.AreEqual(expectedResult, result, 0); }
0
37. Example
View licenseprivate static void Confirm(ValueEval arg, double expectedResult) { ValueEval[] args = { arg, }; double result = NumericFunctionInvoker.Invoke(PercentEval.instance, args, 0, 0); Assert.AreEqual(expectedResult, result, 0); }
0
38. Example
View license[Test] public void TestColumnOperand() { short firstRow = (short)8; short lastRow = (short)12; short colNum = (short)5; AreaPtg areaPtg = new AreaPtg(firstRow, lastRow, colNum, colNum, false, false, false, false); ValueEval[] values = { new NumberEval(27), new NumberEval(29), new NumberEval(35), // value in row 10 new NumberEval(37), new NumberEval(38), }; ValueEval[] args = { EvalFactory.CreateAreaEval(areaPtg, values), }; double result = NumericFunctionInvoker.Invoke(EvalInstances.UnaryPlus, args, 10, (short)20); Assert.AreEqual(35, result, 0); }
0
39. Example
View licenseprivate void Confirm(String formulaText, double expectedResult) { cell11.CellFormula=(formulaText); Evaluator.ClearAllCachedResultValues(); CellValue cv = Evaluator.Evaluate(cell11); if (cv.CellType != CellType.Numeric) { throw new AssertionException("Wrong result type: " + cv.FormatAsString()); } double actualValue = cv.NumberValue; Assert.AreEqual(expectedResult, actualValue, 0); }
0
40. Example
View license[Test] public void TestCountIfWithCriteriaReference() { ValueEval[] values = { new NumberEval(22), new NumberEval(25), new NumberEval(21), new NumberEval(25), new NumberEval(25), new NumberEval(25), }; AreaEval arg0 = EvalFactory.CreateAreaEval("C1:C6", values); ValueEval criteriaArg = EvalFactory.CreateRefEval("A1", new NumberEval(25)); ValueEval[] args = { arg0, criteriaArg, }; double actual = NumericFunctionInvoker.Invoke(new Countif(), args); Assert.AreEqual(4, actual, 0D); }
0
41. Example
View licenseprivate static void ConfirmCountA(int expected, ValueEval[] args) { double result = NumericFunctionInvoker.Invoke(new Counta(), args); Assert.AreEqual(expected, result, 0); }
0
42. Example
View licenseprivate static void ConfirmCountIf(int expected, AreaEval range, ValueEval criteria) { ValueEval[] args = { range, criteria, }; double result = NumericFunctionInvoker.Invoke(new Countif(), args); Assert.AreEqual(expected, result, 0); }
0
43. Example
View licenseprivate static void ConfirmCountBlank(int expected, AreaEval range) { ValueEval[] args = { range }; double result = NumericFunctionInvoker.Invoke(new Countblank(), args); Assert.AreEqual(expected, result, 0); }
0
44. Example
View licenseprivate void Confirm(String formulaText, double expectedResult) { cell11.CellFormula=(formulaText); Evaluator.ClearAllCachedResultValues(); CellValue cv = Evaluator.Evaluate(cell11); if (cv.CellType != CellType.Numeric) { throw new AssertionException("Wrong result type: " + cv.FormatAsString()); } double actualValue = cv.NumberValue; Assert.AreEqual(expectedResult, actualValue, 0); }
0
45. Example
View licenseprivate static void ConfirmXY(Accumulator acc, double[] xarr, double[] yarr, double expectedResult) { double result = 0.0; for (int i = 0; i < xarr.Length; i++) { result += acc.Accumulate(xarr[i], yarr[i]); } Assert.AreEqual(expectedResult, result, 0.0); }
0
46. Example
View license[Test] public void TestEvaluateInSheet() { IWorkbook wb = new HSSFWorkbook(); ISheet sheet = wb.CreateSheet("Sheet1"); IRow row = sheet.CreateRow(0); row.CreateCell(0).SetCellValue(-7500d); row.CreateCell(1).SetCellValue(3000d); row.CreateCell(2).SetCellValue(5000d); row.CreateCell(3).SetCellValue(1200d); row.CreateCell(4).SetCellValue(4000d); row.CreateCell(5).SetCellValue(0.05d); row.CreateCell(6).SetCellValue(0.08d); ICell cell = row.CreateCell(7); cell.CellFormula = (/*setter*/"MIRR(A1:E1, F1, G1)"); HSSFFormulaEvaluator fe = new HSSFFormulaEvaluator(wb); fe.ClearAllCachedResultValues(); fe.EvaluateFormulaCell(cell); double res = cell.NumericCellValue; Assert.AreEqual(0.18736225093, res, 0.00000001); }
0
47. Example
View licenseprivate static void assertFormulaResult(CellValue cv, ICell cell) { double actualValue = cv.NumberValue; double expectedValue = cell.NumericCellValue; // cached formula result calculated by Excel Assert.AreEqual(expectedValue, actualValue, 1E-4); // should agree within 0.01% }
0
48. Example
View license[Test] public void TestCol() { Function target = new Column(); { ValueEval[] args = { EvalFactory.CreateRefEval("C5"), }; double actual = NumericFunctionInvoker.Invoke(target, args); Assert.AreEqual(3, actual, 0D); } { ValueEval[] args = { EvalFactory.CreateAreaEval("E2:H12", new ValueEval[44]), }; double actual = NumericFunctionInvoker.Invoke(target, args); Assert.AreEqual(5, actual, 0D); } }
0
49. Example
View license[Test] public void TestRow() { //throw new NotImplementedException(); Function target = new Row(); { ValueEval[] args = { EvalFactory.CreateRefEval("C5"), }; double actual = NumericFunctionInvoker.Invoke(target, args); Assert.AreEqual(5, actual, 0D); } { ValueEval[] args = { EvalFactory.CreateAreaEval("E2:H12", new ValueEval[44]), }; double actual = NumericFunctionInvoker.Invoke(target, args); Assert.AreEqual(2, actual, 0D); } }
0
50. Example
View licenseprivate static void ConfirmRowsFunc(String areaRefStr, int nCols, int nRows) { ValueEval[] args = { EvalFactory.CreateAreaEval(areaRefStr, new ValueEval[nCols * nRows]), }; double actual = NumericFunctionInvoker.Invoke(new Rows(), args); Assert.AreEqual(nRows, actual, 0D); }