public void TestRealNumberAdd() { RealNumber a = new RealNumber(5); RealNumber b = new RealNumber(15); RealNumber c = new RealNumber(20); a = a.Add(b) as RealNumber; Assert.True(a.CompareTo(c) == 0); }
public void AddTest() { var testVar2 = new RealNumber(2); _testVar = new RealNumber(1); _testVar = _testVar.Add(testVar2); Assert.Equal(3, _testVar.Real); }
public void CanAddFloatNumbers() { var a = new RealNumber(NumericPrecision.Decimal, 500m); var b = new RealNumber(NumericPrecision.Decimal, 750.5m); Assert.AreEqual(500m + 750.5m, a.Add(b).AsDecimal().Value); Assert.AreEqual(500m + 750.5m, (a + b).AsDecimal().Value); a = new RealNumber(NumericPrecision.Float, 123.45f); b = new RealNumber(NumericPrecision.Float, 543.21f); Assert.AreEqual(123.45f + 543.21f, a.Add(b).AsFloat()); Assert.AreEqual(123.45f + 543.21f, (a + b).AsFloat()); }