Ejemplo n.º 1
0
        public void CalSpreadCurveTest(string input)
        {
            Bond.Bond        sampleInput1 = new  Bond.Bond("C1", Bond.BondConst.corp, 10.3, 5.30);
            List <Bond.Bond> bondList     = LoadBondObjects();
            double           actualNum    = Bond.BondRun.CalSpreadCurve(bondList, sampleInput1);
            string           actual       = Math.Round(actualNum, 2, MidpointRounding.AwayFromZero).ToString("N2");

            Assert.True(input.Equals(actual), input);
        }
Ejemplo n.º 2
0
        public void CalSpreadBenchmarkTest(string input)
        {
            Bond.Bond sampleInput1 = new  Bond.Bond("C1", Bond.BondConst.corp, 10.3, 5.30);

            List <Bond.Bond> bondList = LoadBondObjects();

            string actual = Bond.BondRun.CalSpreadBenchmark(bondList, sampleInput1);

            Assert.True(input.Equals(actual), input);
        }
Ejemplo n.º 3
0
        public void ClosestBondsTest(string input)
        {
            Bond.Bond        sampleInput1 = new Bond.Bond("C2", Bond.BondConst.corp, 15.2, 8.30);
            List <Bond.Bond> govBondList  = LoadBondObjects();

            Bond.BondHolder closestBonds = Bond.BondRun.ClosestBonds(govBondList, sampleInput1);
            string          actual       = closestBonds.closeLesserBond.bondID.ToString() + closestBonds.closeGreaterBond.bondID.ToString();

            Assert.True(input.Equals(actual));
        }
Ejemplo n.º 4
0
        ///ToDo: improve this function to take the input from CSV file instead of manually entering results.
        /// <summary>
        /// This function just loads the List of Bond objects for testing purposes.
        /// </summary>

        public static List <Bond.Bond> LoadBondObjects()
        {
            Bond.Bond sampleInput1 = new  Bond.Bond("C1", Bond.BondConst.corp, 10.3, 5.30);

            Bond.Bond        sampleInput2 = new Bond.Bond("G1", Bond.BondConst.gov, 9.4, 3.70);
            Bond.Bond        sampleInput3 = new Bond.Bond("G2", Bond.BondConst.gov, 12, 4.80);
            Bond.Bond        sampleInput4 = new Bond.Bond("G3", Bond.BondConst.gov, 16.3, 5.50);
            List <Bond.Bond> bondList     = new List <Bond.Bond>();

            bondList.Add(sampleInput2);
            bondList.Add(sampleInput3);
            bondList.Add(sampleInput4);
            return(bondList);
        }