public void TestMergeTwoValuationReports()
        {
            string          valReportId1     = Guid.NewGuid().ToString();
            ValuationReport valuationReport1 = CreateSwapValuationReport(valReportId1);

            Assert.AreEqual(
                valReportId1,
                (((Trade)valuationReport1.tradeValuationItem[0].Items[0]).tradeHeader.partyTradeIdentifier[0].Items[0] as TradeId).Value
                );
            string          valReportId2     = Guid.NewGuid().ToString();
            ValuationReport valuationReport2 = CreateSwapValuationReport(valReportId2);

            Assert.AreEqual(
                valReportId2,
                ((valuationReport2.tradeValuationItem[0].Items[0] as Trade).tradeHeader.partyTradeIdentifier[0].Items[0] as TradeId).Value
                );
            Engine.Cache.SaveObject(valuationReport1, Engine.NameSpace + "." + valReportId1, null);
            Engine.Cache.SaveObject(valuationReport2, Engine.NameSpace + "." + valReportId2, null);
            var    excelValuation = new Valuation();
            string mergedReportId = excelValuation.Merge(Engine.Cache, Engine.NameSpace, valReportId1, valReportId2, null, null, null, null, null, null, null, null);
            var    mergedReport   = Engine.Cache.LoadObject <ValuationReport>(Engine.NameSpace + "." + mergedReportId);

            Assert.AreEqual(2, mergedReport.tradeValuationItem.Length);
            Assert.AreNotEqual(mergedReport.header.messageId.Value, valReportId1);
            Assert.AreNotEqual(mergedReport.header.messageId.Value, valReportId2);
            Assert.AreEqual(
                valReportId1,
                ((mergedReport.tradeValuationItem[0].Items[0] as Trade).tradeHeader.partyTradeIdentifier[0].Items[0] as TradeId).Value
                );
            Assert.AreEqual(
                valReportId2,
                ((mergedReport.tradeValuationItem[1].Items[0] as Trade).tradeHeader.partyTradeIdentifier[0].Items[0] as TradeId).Value
                );
        }
        public void GetInfoTwoSwaps()
        {
            string          valReportId1     = Guid.NewGuid().ToString();
            ValuationReport valuationReport1 = CreateSwapValuationReport(valReportId1);
            string          valReportId2     = Guid.NewGuid().ToString();
            ValuationReport valuationReport2 = CreateSwapValuationReport(valReportId2);

            Engine.Cache.SaveObject(valuationReport1, Engine.NameSpace + "." + valReportId1, null);
            Engine.Cache.SaveObject(valuationReport2, Engine.NameSpace + "." + valReportId2, null);
            var    excelValuation = new Valuation();
            string mergedReportId = excelValuation.Merge(Engine.Cache, Engine.NameSpace, valReportId1, valReportId2, null, null, null, null, null, null, null, null);
            //var valuation = Engine.Cache.LoadObject<ValuationReport>(mergedReportId);
            List <ValuationInfoRangeItem> valuationInfoRangeItems = excelValuation.GetInfo(Engine.Cache, Engine.NameSpace, mergedReportId);

            object[,] range = ObjectToArrayOfPropertiesConverter.ConvertListToHorizontalArrayRange(valuationInfoRangeItems);
            Debug.Print("GetInfo (two swaps)");
            Debug.Print(ParameterFormatter.FormatObject(range));
            Assert.AreEqual(3, valuationInfoRangeItems.Count);
            Assert.AreEqual(mergedReportId, valuationInfoRangeItems[0].Id);
            Assert.AreEqual("envelope", valuationInfoRangeItems[0].Description);
            Assert.AreEqual(valReportId1, valuationInfoRangeItems[1].Id);
            Assert.AreEqual("swap(fixed/float)", valuationInfoRangeItems[1].Description);
            Assert.AreEqual(valReportId2, valuationInfoRangeItems[2].Id);
            Assert.AreEqual("swap(fixed/float)", valuationInfoRangeItems[2].Description);
        }