public void CashflowThrowsWhenDifferentNumberOfIntervals()
 {
     ICompanyValuator valuator = new CompanyValuator();
     var cashflows = new List<Interval> { new Interval() };
     var waccs = new List<Interval> { new Interval(), new Interval() };
     Assert.Throws<ValuationException>(() => valuator.Cashflow(cashflows, waccs));
 }
        public void CashflowReturnsProperValueIfEmptyIntervals()
        {
            ICompanyValuator valuator = new CompanyValuator();
            var expectedWaccs = new List<Interval>();
            var expectedCashflows = new List<Interval>();

            var result = valuator.Cashflow(expectedCashflows, expectedWaccs);

            var expectedResult = new Interval(0, 0);
            Assert.NotNull(result);
            Assert.AreEqual(expectedResult.LowerBound, result.LowerBound);
            Assert.AreEqual(expectedResult.UpperBound, result.UpperBound);
        }
        public void CashflowReturnsProperValue()
        {
            ICompanyValuator valuator = new CompanyValuator();
            var k1 = new Interval(0.040m, 0.050m);
            var k2 = new Interval(0.045m, 0.060m);
            var k3 = new Interval(0.050m, 0.060m);

            var expectedWaccs = new List<Interval> { k1, k2, k3 };

            var cfl1 = new Interval(4000, 6000);
            var cfl2 = new Interval(3000, 6000);
            var cfl3 = new Interval(2000, 5000);

            var expectedCashflows = new List<Interval> { cfl1, cfl2, cfl3 };

            var result = valuator.Cashflow(expectedCashflows, expectedWaccs);

            var expectedResult = new Interval(8359m, 15343m);

            Assert.NotNull(result);
            Assert.AreEqual(expectedResult.LowerBound, Math.Round(result.LowerBound));
            Assert.AreEqual(expectedResult.UpperBound, Math.Round(result.UpperBound));
        }
 public void CashflowThrowsWhenNullExpectedWaccs()
 {
     ICompanyValuator valuator = new CompanyValuator();
     Assert.Throws<ArgumentNullException>(() => valuator.Cashflow(new List<Interval>(), null));
 }
 public void CashflowThrowsWhenNullArguments()
 {
     ICompanyValuator valuator = new CompanyValuator();
     Assert.Throws<ArgumentNullException>(() => valuator.Cashflow(null, null));
 }