NUnit.Framework.Assert.AreEqual(double, double, double)

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 7

1. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
View license
[Test]
		public void NegInfinityEqualsInfinity() 
		{
			Assert.AreEqual(Double.NegativeInfinity, Double.NegativeInfinity, 0.0);
		}

2. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
View license
[Test]
		public void NegInfinityEqualsInfinity() 
		{
			Assert.AreEqual(Double.NegativeInfinity, Double.NegativeInfinity, 0.0);
		}

3. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

4. 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);
        }

5. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
View license
[Test]
		public void NanEqualsNaNSucceeds() 
		{
			Assert.AreEqual(Double.NaN, Double.NaN, 0.0);
		}

6. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

7. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

8. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

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);
        }

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);
        }

11. 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);
        }

12. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

13. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

14. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

15. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

16. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

17. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
View license
[Test]
		public void PosInfinityEqualsInfinity() 
		{
			Assert.AreEqual(Double.PositiveInfinity, Double.PositiveInfinity, 0.0);
		}

18. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

19. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

20. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
View license
[Test]
		public void NanEqualsNaNSucceeds() 
		{
			Assert.AreEqual(Double.NaN, Double.NaN, 0.0);
		}

21. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
View license
[Test]
		public void NanEqualsNaNSucceeds() 
		{
			Assert.AreEqual(Double.NaN, Double.NaN, 0.0);
		}

22. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
View license
[Test]
		public void NegInfinityEqualsInfinity() 
		{
			Assert.AreEqual(Double.NegativeInfinity, Double.NegativeInfinity, 0.0);
		}

23. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

24. 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);
        }

25. 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);
        }

26. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

27. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

28. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
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);
		}

29. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
View license
[Test]
		public void PosInfinityEqualsInfinity() 
		{
			Assert.AreEqual(Double.PositiveInfinity, Double.PositiveInfinity, 0.0);
		}

30. Example

Project: ContinuousTests
Source File: EqualsFixture.cs
View license
[Test]
		public void PosInfinityEqualsInfinity() 
		{
			Assert.AreEqual(Double.PositiveInfinity, Double.PositiveInfinity, 0.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);

        }

32. Example

Project: MonoGame.Extended
Source File: TestHelper.cs
View license
public 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);
        }

33. Example

Project: csunits
Source File: MeasureTests.cs
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);
        }

34. Example

Project: NPOI
Source File: TestCountFuncs.cs
View license
private static void ConfirmCountA(int expected, ValueEval[] args)
        {
            double result = NumericFunctionInvoker.Invoke(new Counta(), args);
            Assert.AreEqual(expected, result, 0);
        }

35. Example

Project: NPOI
Source File: TestMirr.cs
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);
        }

36. Example

Project: NPOI
Source File: TestPercentEval.cs
View license
private static void Confirm(ValueEval arg, double expectedResult)
        {
            ValueEval[] args = {
			arg,
		};

            double result = NumericFunctionInvoker.Invoke(PercentEval.instance, args, 0, 0);

            Assert.AreEqual(expectedResult, result, 0);
        }

37. Example

Project: NPOI
Source File: TestCountFuncs.cs
View license
private static void ConfirmCountBlank(int expected, AreaEval range)
        {

            ValueEval[] args = { range };
            double result = NumericFunctionInvoker.Invoke(new Countblank(), args);
            Assert.AreEqual(expected, result, 0);
        }

38. Example

Project: NPOI
Source File: TestRowCol.cs
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);
            }
        }

39. Example

Project: NPOI
Source File: TestDate.cs
View license
private 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);
        }

40. Example

Project: NPOI
Source File: TestUnaryPlusEval.cs
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);
        }

41. Example

Project: NPOI
Source File: TestCountFuncs.cs
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);
        }

42. Example

Project: NPOI
Source File: TestMathX.cs
View license
private 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);
        }

43. Example

Project: NPOI
Source File: TestDivideEval.cs
View license
private 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);
        }

44. Example

Project: NPOI
Source File: TestHSSFClientAnchor.cs
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);
            }

        }

45. Example

Project: NPOI
Source File: TestCalendarFieldFunction.cs
View license
private 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);
        }

46. Example

Project: NPOI
Source File: TestRowCol.cs
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);
            }
        }

47. Example

Project: NPOI
Source File: TestCountFuncs.cs
View license
private 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);
        }

48. Example

Project: NPOI
Source File: TestRowCol.cs
View license
private static void ConfirmColumnsFunc(String areaRefStr, int nCols, int nRows)
        {
            ValueEval[] args = { EvalFactory.CreateAreaEval(areaRefStr, new ValueEval[nCols * nRows]), };

            double actual = NumericFunctionInvoker.Invoke(new Columns(), args);
            Assert.AreEqual(nCols, actual, 0D);
        }

49. Example

Project: NPOI
Source File: TestRowCol.cs
View license
private 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);
        }

50. Example

Project: NPOI
Source File: TestNpv.cs
View license
private 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%
        }