public void CantAddTwice() { using (FinancialClient financialClient = Context.CreateFinancialClient()) { InterpolatedYieldCurveDefinitionMaster interpolatedYieldCurveDefinitionMaster = financialClient.InterpolatedYieldCurveDefinitionMaster; var yieldCurveDefinitionDocument = GenerateDocument(); interpolatedYieldCurveDefinitionMaster.Add(yieldCurveDefinitionDocument); var exception = Assert.Throws <ArgumentException>(() => interpolatedYieldCurveDefinitionMaster.Add(yieldCurveDefinitionDocument)); Assert.True(exception.Message.Contains("Duplicate definition")); } }
public void CantAddOrUpdateAfterAdd() { using (FinancialClient financialClient = Context.CreateFinancialClient()) { InterpolatedYieldCurveDefinitionMaster interpolatedYieldCurveDefinitionMaster = financialClient.InterpolatedYieldCurveDefinitionMaster; var yieldCurveDefinitionDocument = GenerateDocument(); interpolatedYieldCurveDefinitionMaster.Add(yieldCurveDefinitionDocument); interpolatedYieldCurveDefinitionMaster.AddOrUpdate(yieldCurveDefinitionDocument); } }
public void CanAdd() { using (FinancialClient financialClient = Context.CreateFinancialClient()) { InterpolatedYieldCurveDefinitionMaster interpolatedYieldCurveDefinitionMaster = financialClient.InterpolatedYieldCurveDefinitionMaster; var yieldCurveDefinitionDocument = GenerateDocument(); var newDoc = interpolatedYieldCurveDefinitionMaster.Add(yieldCurveDefinitionDocument); Assert.True(ReferenceEquals(newDoc, yieldCurveDefinitionDocument)); Assert.True(ReferenceEquals(newDoc.YieldCurveDefinition, yieldCurveDefinitionDocument.YieldCurveDefinition)); Assert.NotNull(yieldCurveDefinitionDocument.UniqueId); } }
private static void AssertRoundTrip(InterpolatedYieldCurveDefinitionMaster interpolatedYieldCurveDefinitionMaster, YieldCurveDefinitionDocument yieldCurveDefinitionDocument) { interpolatedYieldCurveDefinitionMaster.Add(yieldCurveDefinitionDocument); YieldCurveDefinitionDocument roundtrippedDoc = interpolatedYieldCurveDefinitionMaster.Get(yieldCurveDefinitionDocument.UniqueId); YieldCurveDefinition roundTripped = roundtrippedDoc.YieldCurveDefinition; var yieldCurveDefinition = yieldCurveDefinitionDocument.YieldCurveDefinition; Assert.Equal(yieldCurveDefinition.Name, roundTripped.Name); Assert.Equal(yieldCurveDefinition.InterpolatorName, roundTripped.InterpolatorName); Assert.Equal(yieldCurveDefinition.Currency, roundTripped.Currency); Assert.Equal(roundTripped.Region, roundTripped.Region); Assert.True(roundTripped.Strips.SequenceEqual(roundTripped.Strips)); }