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