Example #1
0
 [InlineData(10100.0, 10100.0, 70.0, 20.0, 2.0, 0, 0)] // cost = salvage
 public void DDB(double Cost, double Salvage, double Life, double Period, double Factor, double expectedOld, double expectedNew)
 {
     if (PlatformDetection.IsAlpine)
     {
         // some tests fail due to precision
         return;
     }
     AreEqual(expectedOld, expectedNew, Financial.DDB(Cost, Salvage, Life, Period, Factor));
 }
Example #2
0
        public void DDB()
        {
            double ddb = Financial.DDB(1000, 50, 10, 5, 3);

            Assert.AreEqual(72.03, ddb, 1E-10);
            ddb = Financial.DDB(1000, 50, 10, 5, 2);
            Assert.AreEqual(81.92, ddb, 1E-10);
            ddb = Financial.DDB(1000, 50, 10, 1, 0.1);
            Assert.AreEqual(10, ddb, 1E-10);
            ddb = Financial.DDB(1000, 50, 10, 0.3, 0.1);
            Assert.AreEqual(10, ddb, 1E-10);
        }
Example #3
0
        public void DDB_1()
        {
            Assert.AreEqual(47.999403820109578, Financial.DDB(1500, 120, 24, 12, 2.0), 1E-10);
            Assert.AreEqual(479.9940382010958, Financial.DDB(15000, 1000, 24, 12, 2.0), 1E-10);

            Assert.AreEqual(391.34749179845591, Financial.DDB(15000, 1000, 48, 12, 2.0), 1E-10);

            Assert.AreEqual(33.646996435384537, Financial.DDB(1500, 120, 24, 12, 4.0), 1E-10);

            Assert.AreEqual(43.160836714378092, Financial.DDB(1500, 100, 48, 12, 6.0), 1E-10);

            Assert.AreEqual(24.789790003786901, Financial.DDB(1500, 100, 48, 12, 1.0), 1E-10);

            Assert.AreEqual(383.10767441791506, Financial.DDB(15000, 1000, 48, 12.5, 2.0), 1E-10);
        }
Example #4
0
 [InlineData(10100.0, 10100.0, 70.0, 20.0, 2.0, 0, -1)] // cost = salvage
 public void DDB(double Cost, double Salvage, double Life, double Period, double Factor, double expected, int relativePrecision)
 {
     Assert.Equal(expected, Financial.DDB(Cost, Salvage, Life, Period, Factor), s_precision + relativePrecision);
 }
Example #5
0
 public void DDBArg6()
 {
     // Period has to be > 0
     Financial.DDB(1, 1, 1, 0, 1);
 }
Example #6
0
 public void DDBArg5()
 {
     // Period has to be <= Life
     Financial.DDB(1, 1, 1, 2, 1);
 }
Example #7
0
 public void DDBArg4()
 {
     Financial.DDB(1, 1, 1, 1, 0);
 }
Example #8
0
 public void DDBArg3()
 {
     Financial.DDB(1, 1, 0, 1, 1);
 }
Example #9
0
 public void DDBArg2()
 {
     Financial.DDB(1, -1, 1, 1, 1);
 }
Example #10
0
 [InlineData(10100.0, 10100.0, 70.0, 20.0, 2.0, 0, 0)] // cost = salvage
 public void DDB(double Cost, double Salvage, double Life, double Period, double Factor, double expectedOld, double expectedNew)
 {
     AreEqual(expectedOld, expectedNew, Financial.DDB(Cost, Salvage, Life, Period, Factor));
 }
Example #11
0
 //[ExpectedException(typeof(ArgumentException))]
 //LAMESPEC: MSDN claims the exception should be thrown in this case
 public void DDB_5()
 {
     // Argument 'Factor' is not a valid value.
     double d = Financial.DDB(-5, 120, 48, 24, 2.0);
 }
Example #12
0
 public void DDB_4()
 {
     // Argument 'Factor' is not a valid value.
     double d = Financial.DDB(1500, -2, 48, 24, 2.0);
 }
Example #13
0
 public void DDB_3()
 {
     // Argument 'Factor' is not a valid value.
     double d = Financial.DDB(1500, 120, 48, 24, -1);
 }
Example #14
0
 public void DDB_Default()
 {
     AreEqual(57.3268063538875, 57.32680635388748, Financial.DDB(10000.0, 4350.0, 84.0, 35.0));
 }
Example #15
0
 public void DDB_Default()
 {
     Assert.Equal(57.32680635388748, Financial.DDB(10000.0, 4350.0, 84.0, 35.0), s_precision - 2);
 }
Example #16
0
 public void DDB_Invalid(double Cost, double Salvage, double Life, double Period, double Factor)
 {
     Assert.Throws <ArgumentException>(() => Financial.DDB(Cost, Salvage, Life, Period, Factor));
 }
Example #17
0
 public void DDB_7()
 {
     // Argument 'Factor' is not a valid value.
     double d = Financial.DDB(1500, 120, -2, -5, 2.0);
 }