diff --git a/ifrs17-template/Test/AocStructureTest.ipynb b/ifrs17-template/Test/AocStructureTest.ipynb index 91bf53b8..b52e9153 100644 --- a/ifrs17-template/Test/AocStructureTest.ipynb +++ b/ifrs17-template/Test/AocStructureTest.ipynb @@ -94,12 +94,13 @@ { "cell_type": "code", "source": [ - "public async Task CheckAocStepStructureAsync(IEnumerable inputVariables, ", + "public async Task CheckAocStepStructureAsync(IEnumerable inputVariables, ", "\n Dictionary> parentBm, ", "\n Dictionary referenceBm, ", "\n Dictionary> fullAocBm,", "\n Dictionary> parentBmCdr = null)", "\n{", + "\n Activity.Start();", "\n //Save test input data", "\n var importFormat = ImportFormats.Cashflow;", "\n var inputSource = InputSource.Cashflow;", @@ -232,6 +233,7 @@ "\n }", "\n ", "\n if(errors.Any()) ApplicationMessage.Log(Error.Generic, string.Join(\"\\n\", errors));", + "\n return Activity.Finish();", "\n}", "\n" ], @@ -502,7 +504,17 @@ { "cell_type": "code", "source": [ - "await CheckAocStepStructureAsync(inputRawVariables, parentBm, referenceBm, fullAocBm, parentBm_CDR)" + "var activity = await CheckAocStepStructureAsync(inputRawVariables, parentBm, referenceBm, fullAocBm, parentBm_CDR);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -604,7 +616,17 @@ { "cell_type": "code", "source": [ - "await CheckAocStepStructureAsync(inputRawVariables, parentBm, referenceBm, fullAocBm)" + "var activity = await CheckAocStepStructureAsync(inputRawVariables, parentBm, referenceBm, fullAocBm);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -679,7 +701,17 @@ { "cell_type": "code", "source": [ - "await CheckAocStepStructureAsync(inputIfrsVariables, parentBm, referenceBm, fullAocBm)" + "var activity = await CheckAocStepStructureAsync(inputIfrsVariables, parentBm, referenceBm, fullAocBm);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, diff --git a/ifrs17-template/Test/ImportStorageTest.ipynb b/ifrs17-template/Test/ImportStorageTest.ipynb index 24387d42..19b809b5 100644 --- a/ifrs17-template/Test/ImportStorageTest.ipynb +++ b/ifrs17-template/Test/ImportStorageTest.ipynb @@ -82,16 +82,16 @@ "//Define partition", "\nvar args = new ImportArgs(reportingNode, 2021, 3, Periodicity.Quarterly, scenario, ImportFormats.Actual);", "\nvar previousArgs = new ImportArgs(reportingNode, 2020, 12, Periodicity.Quarterly, scenario, ImportFormats.Actual);", - "\nvar partition = new PartitionByReportingNodeAndPeriod { Id = (Guid)(await DataSource.Partition.GetKeyForInstanceAsync(args)),", + "\nvar partition = new PartitionByReportingNodeAndPeriod { Id = (Guid)(await DataSource.Partition.GetKeyForInstanceAsync(args)),", "\n ReportingNode = reportingNode, ", "\n Scenario = scenario, ", "\n Year = args.Year,", "\n Month = args.Month };", - "\nvar previousPeriodPartition = new PartitionByReportingNodeAndPeriod { Id = (Guid)(await DataSource.Partition.GetKeyForInstanceAsync(previousArgs)),", + "\nvar previousPeriodPartition = new PartitionByReportingNodeAndPeriod { Id = (Guid)(await DataSource.Partition.GetKeyForInstanceAsync(previousArgs)),", "\n ReportingNode = reportingNode, ", "\n Scenario = scenario, ", - "\n Year = args.Year,", - "\n Month = args.Month };", + "\n Year = previousArgs.Year,", + "\n Month = previousArgs.Month };", "\nawait DataSource.UpdateAsync(new[]{partition, previousPeriodPartition});", "\nawait DataSource.CommitAsync();" ], @@ -102,8 +102,9 @@ { "cell_type": "code", "source": [ - "public async Task CheckIfrsVariablesFromImportStorageAsync(string importFormat, IEnumerable inputDataSetForWorkspace, IEnumerable inputDataSetForDataSource, IEnumerable ivsBenchmark)", + "public async Task CheckIfrsVariablesFromImportStorageAsync(string importFormat, IEnumerable inputDataSetForWorkspace, IEnumerable inputDataSetForDataSource, IEnumerable ivsBenchmark)", "\n{", + "\n Activity.Start();", "\n //Prepare Workspace and DataSource", "\n await Workspace.UpdateAsync(inputDataSetForWorkspace);", "\n await DataSource.UpdateAsync(inputDataSetForDataSource);", @@ -132,6 +133,7 @@ "\n if(ivsByIdentityString.Any()) errors.Add($\"IfrsVariables in the storage have duplicated items for:\\n{string.Join(\"\\n\",ivsByIdentityString)}.\");", "\n ", "\n if(errors.Any()) ApplicationMessage.Log(Error.Generic, string.Join(\"\\n\", errors));", + "\n return Activity.Finish();", "\n}" ], "metadata": {}, @@ -160,7 +162,17 @@ "\n basicIfrsVariable with {AocType = AocTypes.WO, Value = 15.0},", "\n };", "\n", - "\nawait CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);" + "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -193,7 +205,17 @@ "\n basicIfrsVariable with {AocType = AocTypes.WO, Value = -20.0},", "\n };", "\n", - "\nawait CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);" + "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -228,7 +250,17 @@ "\n basicIfrsVariable with {AocType = AocTypes.WO, EstimateType = EstimateTypes.AA, Novelty = Novelties.C, Value = -20.0},", "\n };", "\n", - "\nawait CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);" + "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -271,7 +303,17 @@ "\n basicAdvanceActualIfrsVariable with {AocType = AocTypes.WO, Value = -20.0},", "\n };", "\n", - "\nawait CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);" + "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -324,7 +366,17 @@ "\n basicIfrsVariable with {AocType = AocTypes.WO, Value = 15.0},", "\n };", "\n", - "\nawait CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);" + "\nvar activity = await CheckIfrsVariablesFromImportStorageAsync(ImportFormats.Actual, inputDataSetForWorkspace, inputDataSetForDataSource, ivsBenchmark);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -455,8 +507,9 @@ { "cell_type": "code", "source": [ - "public async Task CheckGetUnderlyingGicsAsync(RawVariable[] inputDataVariable, Dictionary> underlyingGicBm)", + "public async Task CheckGetUnderlyingGicsAsync(RawVariable[] inputDataVariable, Dictionary> underlyingGicBm)", "\n{", + "\n Activity.Start();", "\n var errors = new List();", "\n ", "\n await PrepareWorkspaceDataNodes();", @@ -476,6 +529,7 @@ "\n await Workspace.DeleteAsync(Workspace.Query());", "\n await CleanWorkspaceDataNodes();", "\n if(errors.Any()) ApplicationMessage.Log(Error.Generic, string.Join(\"\\n\", errors));", + "\n return Activity.Finish();", "\n}" ], "metadata": {}, @@ -493,7 +547,17 @@ "\n {\"Reins2\",new string[]{\"Gross1\",\"Gross2\"}},", "\n};", "\n", - "\nawait CheckGetUnderlyingGicsAsync(inputDataVariable, underlyingGicBm);" + "\nvar activity = await CheckGetUnderlyingGicsAsync(inputDataVariable, underlyingGicBm);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -508,7 +572,17 @@ "\n {\"Reins2\",new string[]{\"Gross1\",\"Gross2\"}},", "\n};", "\n", - "\nawait CheckGetUnderlyingGicsAsync(inputDataVariable, underlyingGicBm);" + "\nvar activity = await CheckGetUnderlyingGicsAsync(inputDataVariable, underlyingGicBm);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -526,10 +600,11 @@ { "cell_type": "code", "source": [ - "public async Task CheckGetReinsuranceCoverageAsync(RawVariable[] inputDataVariable, ", + "public async Task CheckGetReinsuranceCoverageAsync(RawVariable[] inputDataVariable, ", "\n Dictionary<(string, string),double> reinsCovBoPBm, ", "\n Dictionary<(string, string),double> reinsCovEoPBm)", "\n{", + "\n Activity.Start();", "\n var errors = new List();", "\n", "\n await PrepareWorkspaceDataNodes();", @@ -566,6 +641,7 @@ "\n await Workspace.DeleteAsync(Workspace.Query());", "\n await CleanWorkspaceDataNodes();", "\n if(errors.Any()) ApplicationMessage.Log(Error.Generic, string.Join(\"\\n\", errors));", + "\n return Activity.Finish();", "\n}" ], "metadata": {}, @@ -590,7 +666,17 @@ "\n {(\"Reins2\",\"Gross2\"),0.7},", "\n};", "\n", - "\nawait CheckGetReinsuranceCoverageAsync(inputDataVariable, reinsCovBoPBm, reinsCovEoPBm);" + "\nvar activity = await CheckGetReinsuranceCoverageAsync(inputDataVariable, reinsCovBoPBm, reinsCovEoPBm);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -608,8 +694,9 @@ { "cell_type": "code", "source": [ - "public async Task CheckSecondaryScopeAsync(RawVariable[] inputDataVariable, string[] primaryScopeBm, string[] secondaryScopeBm)", + "public async Task CheckSecondaryScopeAsync(RawVariable[] inputDataVariable, string[] primaryScopeBm, string[] secondaryScopeBm)", "\n{", + "\n Activity.Start();", "\n var errors = new List();", "\n ", "\n await PrepareWorkspaceDataNodes();", @@ -639,6 +726,7 @@ "\n await Workspace.DeleteAsync(Workspace.Query());", "\n await CleanWorkspaceDataNodes();", "\n if(errors.Any()) ApplicationMessage.Log(Error.Generic, string.Join(\"\\n\", errors));", + "\n return Activity.Finish();", "\n}" ], "metadata": {}, @@ -653,7 +741,17 @@ "\n };", "\nvar primaryScopeBm = new string[]{\"Reins1\", \"Reins2\"};", "\nvar secondaryScopeBm = new string[]{\"Gross1\", \"Gross2\"};", - "\nawait CheckSecondaryScopeAsync(inputDataVariable, primaryScopeBm, secondaryScopeBm);" + "\nvar activity = await CheckSecondaryScopeAsync(inputDataVariable, primaryScopeBm, secondaryScopeBm);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -666,7 +764,17 @@ "\n };", "\nvar primaryScopeBm = new string[]{\"Reins1\"};", "\nvar secondaryScopeBm = new string[]{\"Gross1\"};", - "\nawait CheckSecondaryScopeAsync(inputDataVariable, primaryScopeBm, secondaryScopeBm);" + "\nvar activity = await CheckSecondaryScopeAsync(inputDataVariable, primaryScopeBm, secondaryScopeBm);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -680,7 +788,17 @@ "\n };", "\nvar primaryScopeBm = new string[]{\"Reins1\",\"Gross1\",\"Reins2\"};", "\nvar secondaryScopeBm = new string[]{\"Gross2\"};", - "\nawait CheckSecondaryScopeAsync(inputDataVariable, primaryScopeBm, secondaryScopeBm);" + "\nvar activity = await CheckSecondaryScopeAsync(inputDataVariable, primaryScopeBm, secondaryScopeBm);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, diff --git a/ifrs17-template/Test/MapTemplateAndImportTest.ipynb b/ifrs17-template/Test/MapTemplateAndImportTest.ipynb index f06f2428..cd6603fd 100644 --- a/ifrs17-template/Test/MapTemplateAndImportTest.ipynb +++ b/ifrs17-template/Test/MapTemplateAndImportTest.ipynb @@ -537,11 +537,13 @@ { "cell_type": "code", "source": [ - "public async Task CheckErrors(string inputFileName, List errorBms)", + "public async Task CheckErrors(string inputFileName, List errorBms)", "\n{", + "\n Activity.Start();", "\n var log = await Import.FromFile(inputFileName).WithFormat(ImportFormats.DataNodeParameter).WithTarget(Workspace).ExecuteAsync();", "\n Workspace.Reset(x => x.ResetInitializationRules().ResetCurrentPartitions());", "\n errorBms.Intersect(log.Errors.Select(x => x.ToString().Substring(0,x.ToString().Length-2).Substring(40)).ToArray()).Count().Should().Be(errorBms.Count());", + "\n return Activity.Finish();", "\n}" ], "metadata": {}, @@ -555,7 +557,8 @@ "\nvar errorsBm = new List(){Get(Error.InvalidDataNode, \"DataNodeInvalid0\"),", "\n Get(Error.InvalidDataNode, \"DataNodeInvalid1\"),", "\n Get(Error.InvalidDataNode, \"DataNodeInvalid2\")};", - "\nawait CheckErrors(inputFileName, errorsBm);" + "\nvar activity = await CheckErrors(inputFileName, errorsBm);", + "\nactivity" ], "metadata": {}, "execution_count": 0, @@ -567,7 +570,8 @@ "var inputFileName = \"Data/DataNodeParameter_Duplicate.csv\";", "\nvar errorsBm = new List(){Get(Error.DuplicateSingleDataNode, \"DT1.1\"),", "\n Get(Error.DuplicateInterDataNode, \"DT1.1\",\"DTR1.1\"),};", - "\nawait CheckErrors(inputFileName, errorsBm);" + "\nvar activity = await CheckErrors(inputFileName, errorsBm);", + "\nactivity" ], "metadata": {}, "execution_count": 0, @@ -578,7 +582,8 @@ "source": [ "var inputFileName = \"Data/DataNodeParameter_InvalidReinsCov.csv\";", "\nvar errorsBm = new List(){Get(Error.ReinsuranceCoverageDataNode, \"DT1.1\",\"DT1.1\")};", - "\nawait CheckErrors(inputFileName, errorsBm);" + "\nvar activity = await CheckErrors(inputFileName, errorsBm);", + "\nactivity" ], "metadata": {}, "execution_count": 0, diff --git a/ifrs17-template/Test/ReportStorageTest.ipynb b/ifrs17-template/Test/ReportStorageTest.ipynb index 851ea575..0f49a5d2 100644 --- a/ifrs17-template/Test/ReportStorageTest.ipynb +++ b/ifrs17-template/Test/ReportStorageTest.ipynb @@ -48,8 +48,9 @@ { "cell_type": "code", "source": [ - "public async Task CheckGetFx(string currentCurrency, string targetCurrency, int year, int month, IEnumerable testData, double fxBOPBenchmark, double fxAVGBenchmark, double fxEOPBenchmark)", + "public async Task CheckGetFx(string currentCurrency, string targetCurrency, int year, int month, IEnumerable testData, double fxBOPBenchmark, double fxAVGBenchmark, double fxEOPBenchmark)", "\n{", + "\n Activity.Start();", "\n await Workspace.UpdateAsync(testData);", "\n ", "\n //Create report storage", @@ -68,6 +69,7 @@ "\n fxEOP.Should().Be(fxEOPBenchmark);", "\n ", "\n await Workspace.DeleteAsync(Workspace.Query().ToArray());", + "\n return Activity.Finish();", "\n}" ], "metadata": {}, @@ -84,7 +86,17 @@ "\n new ExchangeRate{ Currency = \"USD\", Year = 2020, Month = 12, FxType = FxType.Spot, FxToGroupCurrency = 5 },", "\n new ExchangeRate{ Currency = \"USD\", Year = 2021, Month = 6, FxType = FxType.Average, FxToGroupCurrency = 2 },", "\n new ExchangeRate{ Currency = \"USD\", Year = 2021, Month = 6, FxType = FxType.Spot, FxToGroupCurrency = 0.5 }};", - "\nawait CheckGetFx(\"EUR\", \"USD\", 2021, 6, testData, 2, 10, 60);" + "\nvar activity = await CheckGetFx(\"EUR\", \"USD\", 2021, 6, testData, 2, 10, 60);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, diff --git a/ifrs17-template/Test/ReportVariablesTest.ipynb b/ifrs17-template/Test/ReportVariablesTest.ipynb index 978d2a5e..1ed77b94 100644 --- a/ifrs17-template/Test/ReportVariablesTest.ipynb +++ b/ifrs17-template/Test/ReportVariablesTest.ipynb @@ -131,8 +131,9 @@ { "cell_type": "code", "source": [ - "public async Task RunTestAsync () ", + "public async Task RunTestAsync () ", "\n{", + "\n Activity.Start();", "\n scopesData = await GetScopesDataAsync(args, reportStorage, Scopes);", "\n benchmarkData = await GetBenchmarkDataAsync(args, path, Workspace, Import);", "\n", @@ -145,6 +146,7 @@ "\n //.Excluding(o => o.Value)", "\n .Using(ctx => ctx.Subject.Should().BeApproximately(ctx.Expectation, BenchmarkPrecision))", "\n .WhenTypeIs() );", + "\n return Activity.Finish();", "\n}" ], "metadata": {}, @@ -173,7 +175,17 @@ "cell_type": "code", "source": [ "args = ((2020, 12), \"CH\", null, CurrencyType.Contractual);", - "\nawait RunTestAsync()" + "\nvar activity = await RunTestAsync();", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -192,7 +204,17 @@ "cell_type": "code", "source": [ "args = ((2021, 3), \"CH\", null, CurrencyType.Contractual);", - "\nawait RunTestAsync()" + "\nvar activity = await RunTestAsync();", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -211,7 +233,17 @@ "cell_type": "code", "source": [ "args = ((2020, 12), \"CH\", \"MTUP10pct\", CurrencyType.Contractual);", - "\nawait RunTestAsync()" + "\nvar activity = await RunTestAsync();", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, diff --git a/ifrs17-template/Test/ReportVariablesTestBase.ipynb b/ifrs17-template/Test/ReportVariablesTestBase.ipynb index 36d07af7..a41671c0 100644 --- a/ifrs17-template/Test/ReportVariablesTestBase.ipynb +++ b/ifrs17-template/Test/ReportVariablesTestBase.ipynb @@ -146,7 +146,8 @@ "static async Task> GetBenchmarkDataAsync(((int Year, int Month) Period, string ReportingNode, string Scenario, CurrencyType CurrencyType) args, string path, IWorkspace workspace, IImportVariable importVariable) {", "\n var bmFileName = benchmarkFileNamePrefix + GetBenchmarkFileName(args) + \".csv\";", "\n await workspace.Partition.SetAsync(new { ReportingNode = args.ReportingNode, Scenario = args.Scenario, Year = args.Period.Year, Month = args.Period.Month });", - "\n await importVariable.FromFile(path + bmFileName).WithType(x => x.SnapshotMode()).WithTarget(workspace).ExecuteAsync();", + "\n var log = await importVariable.FromFile(path + bmFileName).WithType(x => x.SnapshotMode()).WithTarget(workspace).ExecuteAsync();", + "\n ApplicationMessage.Log(log);", "\n var ret = await workspace.Query().ToArrayAsync();", "\n workspace.Reset(x => x.ResetCurrentPartitions().ResetType());", "\n return ret;", diff --git a/ifrs17-template/Test/SequenceImportTest.ipynb b/ifrs17-template/Test/SequenceImportTest.ipynb index 1b9b3bcf..8a1b0187 100644 --- a/ifrs17-template/Test/SequenceImportTest.ipynb +++ b/ifrs17-template/Test/SequenceImportTest.ipynb @@ -156,6 +156,24 @@ "execution_count": 0, "outputs": [] }, + { + "cell_type": "code", + "source": [ + "ifrsVars1.Count().Should().NotBe(0);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "ifrsVars2.Count().Should().NotBe(0);" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, { "cell_type": "code", "source": [ diff --git a/ifrs17-template/Test/TechnicalMarginTest.ipynb b/ifrs17-template/Test/TechnicalMarginTest.ipynb index 1407c020..8d0d4f34 100644 --- a/ifrs17-template/Test/TechnicalMarginTest.ipynb +++ b/ifrs17-template/Test/TechnicalMarginTest.ipynb @@ -90,8 +90,9 @@ { "cell_type": "code", "source": [ - "public async Task CheckSwitchLogicAsync(IEnumerable inputDataSet, Dictionary csmLcSwitchBenchmark)", + "public async Task CheckSwitchLogicAsync(IEnumerable inputDataSet, Dictionary csmLcSwitchBenchmark)", "\n{", + "\n Activity.Start();", "\n //Save test input data", "\n await Workspace.UpdateAsync(inputDataSet);", "\n ", @@ -154,6 +155,7 @@ "\n }", "\n ", "\n if(errors.Any()) ApplicationMessage.Log(Error.Generic, string.Join(\"\\n\", errors));", + "\n return Activity.Finish();", "\n}" ], "metadata": {}, @@ -214,7 +216,17 @@ "\n {new AocStep(\"EOP\",\"C\"),(146.5d, 0d)},", "\n };", "\n", - "\nawait CheckSwitchLogicAsync(inputDataSet, csmLcSwitch_benchmark);" + "\nvar activity = await CheckSwitchLogicAsync(inputDataSet, csmLcSwitch_benchmark);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -240,7 +252,17 @@ "\n {new AocStep(\"EOP\",\"C\"),(29d, 0d)},", "\n };", "\n", - "\nawait CheckSwitchLogicAsync(inputDataSet, csmLcSwitch_benchmark);" + "\nvar activity = await CheckSwitchLogicAsync(inputDataSet, csmLcSwitch_benchmark);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -279,7 +301,17 @@ "\n {new AocStep(\"EOP\",\"C\"),( 11d, 0d)},", "\n };", "\n", - "\nawait CheckSwitchLogicAsync(inputDataSet, csmLcSwitch_benchmark);" + "\nvar activity = await CheckSwitchLogicAsync(inputDataSet, csmLcSwitch_benchmark);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, diff --git a/ifrs17/Test/QueriesTest.ipynb b/ifrs17/Test/QueriesTest.ipynb index a3f67136..0bf6dc5d 100644 --- a/ifrs17/Test/QueriesTest.ipynb +++ b/ifrs17/Test/QueriesTest.ipynb @@ -57,10 +57,11 @@ { "cell_type": "code", "source": [ - "public async Task CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(Args args, IEnumerable testData, ", + "public async Task CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(Args args, IEnumerable testData, ", "\n (int Year, int Month, string Scenario) expectedCurrentPeriod, ", "\n (int Year, int Month, string Scenario) expectedPreviousPeriod)", "\n{", + "\n Activity.Start();", "\n await Workspace.UpdateAsync(testData);", "\n var eurCurrentAndPreviousYieldCurve = (await Workspace.LoadCurrentAndPreviousParameterAsync(args, x => x.Currency))[\"EUR\"];", "\n ", @@ -75,6 +76,7 @@ "\n eurCurrentAndPreviousYieldCurve[PreviousPeriod].Scenario.Should().Be(expectedPreviousPeriod.Scenario);", "\n ", "\n await Workspace.DeleteAsync(Workspace.Query().ToArray());", + "\n return Activity.Finish();", "\n}" ], "metadata": {}, @@ -86,7 +88,17 @@ "source": [ "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,null);", "\nvar testData = new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 9};", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData.RepeatOnce(), (2020, 9, null),(2020, 9, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData.RepeatOnce(), (2020, 9, null),(2020, 9, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -98,7 +110,17 @@ "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,scenario);", "\nvar testData = new[] { new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 9, Scenario = scenario }, ", "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 9 } };", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 9, scenario),(2020, 9, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 9, scenario),(2020, 9, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -109,7 +131,17 @@ "source": [ "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,null);", "\nvar testData = new YieldCurve{ Currency = \"EUR\", Year = 2019, Month = 12, Scenario = null};", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData.RepeatOnce(), (2019, 12, null), (2019, 12, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData.RepeatOnce(), (2019, 12, null), (2019, 12, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -121,7 +153,17 @@ "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,scenario);", "\nvar testData = new YieldCurve[] {new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 9, Scenario = scenario},", "\n new YieldCurve{ Currency = \"EUR\", Year = 2019, Month = 12, Scenario = null}};", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 9, scenario), (2019, 12, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 9, scenario), (2019, 12, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -133,7 +175,17 @@ "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,null);", "\nvar testData = new YieldCurve[] {new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Scenario = null}, ", "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 3, Scenario = null}};", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 6, null), (2020, 6, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 6, null), (2020, 6, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -145,7 +197,17 @@ "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,scenario);", "\nvar testData = new YieldCurve[] {new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Scenario = null}, ", "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 3, Scenario = null}};", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 6, null), (2020, 6, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 6, null), (2020, 6, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -157,7 +219,17 @@ "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,scenario);", "\nvar testData = new YieldCurve[] {new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Scenario = null}, ", "\n new YieldCurve{ Currency = \"EUR\", Year = 2019, Month = 3, Scenario = null}};", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 6, null), (2019, 3, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 6, null), (2019, 3, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -169,7 +241,17 @@ "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,null);", "\nvar testData = new YieldCurve[] {new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 9, Scenario = null}, ", "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 6, Scenario = null}};", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 9, null), (2020, 9, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 9, null), (2020, 9, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -181,7 +263,17 @@ "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,null);", "\nvar testData = new YieldCurve[] {new YieldCurve{ Currency = \"EUR\", Year = 2019, Month = 9, Scenario = null}, ", "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 9, Scenario = null}};", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 9, null), (2019, 9, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 9, null), (2019, 9, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -194,7 +286,17 @@ "\nvar testData = new YieldCurve[] {new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 9, Scenario = scenario},", "\n new YieldCurve{ Currency = \"EUR\", Year = 2019, Month = 12, Scenario = scenario},", "\n new YieldCurve{ Currency = \"EUR\", Year = 2019, Month = 12, Scenario = null}};", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 9, scenario), (2019, 12, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 9, scenario), (2019, 12, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -206,7 +308,17 @@ "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,null);", "\nvar testData = new YieldCurve[] {new YieldCurve{ Currency = \"EUR\", Year = 2019, Month = 12, Scenario = null}, ", "\n new YieldCurve{ Currency = \"EUR\", Year = 2019, Month = 9, Scenario = null}};", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2019, 12, null), (2019, 12, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2019, 12, null), (2019, 12, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -218,7 +330,17 @@ "var args = new Args(\"CH\",2020,9,Periodicity.Monthly,null);", "\nvar testData = new YieldCurve[] {new YieldCurve{ Currency = \"EUR\", Year = 2019, Month = 12, Scenario = null}, ", "\n new YieldCurve{ Currency = \"EUR\", Year = 2018, Month = 9, Scenario = null}};", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2019, 12, null), (2019, 12, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2019, 12, null), (2019, 12, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -231,7 +353,17 @@ "\nvar testData = new YieldCurve[] {new YieldCurve{ Currency = \"EUR\", Year = 2019, Month = 6, Scenario = null}, ", "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 9, Scenario = null},", "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 6, Scenario = null}};", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2019, 6, null), (2019, 6, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2019, 6, null), (2019, 6, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -245,7 +377,17 @@ "\n new YieldCurve{ Currency = \"EUR\", Year = 2019, Month = 6, Scenario = null},", "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 9, Scenario = null},", "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 6, Scenario = null}};", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2019, 6, null), (2019, 6, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2019, 6, null), (2019, 6, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -259,7 +401,17 @@ "\n new YieldCurve{ Currency = \"EUR\", Year = 2020, Month = 3, Scenario = null}, ", "\n new YieldCurve{ Currency = \"EUR\", Year = 2015, Month = 9, Scenario = null},", "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Scenario = null}};", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 6, null), (2016, 3, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 6, null), (2016, 3, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -274,7 +426,17 @@ "\n new YieldCurve{ Currency = \"EUR\", Year = 2021, Month = 9, Scenario = null},", "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Scenario = null}};", "\n", - "\nawait CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 6, null), (2016, 3, null));" + "\nvar activity = await CheckLoadCurrentAndPreviousParameterForYieldCurveAsync(args, testData, (2020, 6, null), (2016, 3, null));", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -292,8 +454,9 @@ { "cell_type": "code", "source": [ - "public async Task CheckLoadDataNodeStateAsync(Args args, IEnumerable testData, bool isExpectedToBeActive)", + "public async Task CheckLoadDataNodeStateAsync(Args args, IEnumerable testData, bool isExpectedToBeActive)", "\n{", + "\n Activity.Start();", "\n await Workspace.Partition.SetAsync(args);", "\n await Workspace.UpdateAsync(testData);", "\n var isActive = (await Workspace.LoadDataNodeStateAsync(args)).Keys.Contains(gic);", @@ -301,6 +464,7 @@ "\n isActive.Should().Be(isExpectedToBeActive);", "\n ", "\n Workspace.Reset(x => x.ResetCurrentPartitions());", + "\n return Activity.Finish();", "\n}" ], "metadata": {}, @@ -313,7 +477,17 @@ "var args = new Args(\"CH\",2020,12,Periodicity.Monthly,null);", "\nvar testData = new DataNodeState[] {new DataNodeState{ DataNode = gic, Year = 2019, Month = 12, State = State.Active },", "\n new DataNodeState{ DataNode = gic, Year = 2020, Month = 6, State = State.Inactive }};", - "\nawait CheckLoadDataNodeStateAsync(args, testData, false);" + "\nvar activity = await CheckLoadDataNodeStateAsync(args, testData, false);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -325,7 +499,17 @@ "var args = new Args(\"CH\",2020,12,Periodicity.Monthly,null);", "\nvar testData = new DataNodeState[] {new DataNodeState{ DataNode = gic, Year = 2020, Month = 3, State = State.Active },", "\n new DataNodeState{ DataNode = gic, Year = 2020, Month = 9, State = State.Inactive }};", - "\nawait CheckLoadDataNodeStateAsync(args, testData, false);" + "\nvar activity = await CheckLoadDataNodeStateAsync(args, testData, false);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -343,12 +527,13 @@ { "cell_type": "code", "source": [ - "public async Task CheckLoadYieldCurveAsync(Args args, IEnumerable testData, ", + "public async Task CheckLoadYieldCurveAsync(Args args, IEnumerable testData, ", "\n (int year , int month) dataNodeYearAndMonth, ", "\n double expectedCurrentPreviousFirstYcValue,", "\n double expectedCurrentFirstYcValue,", "\n double expectedLockedFirstYcValue)", "\n{", + "\n Activity.Start();", "\n await Workspace.Partition.SetAsync(args);", "\n await Workspace.UpdateAsync(testData);", "\n await Workspace.UpdateAsync(new ReportingNode[]{new ReportingNode{Currency=\"EUR\",SystemName=\"CH\"}});", @@ -373,6 +558,7 @@ "\n errors.Add( $\"LockedIn YieldCurve not matching:\\n Expected {expectedLockedFirstYcValue} \\n Computed {lockedYc}.\" );", "\n ", "\n if(errors.Any()) ApplicationMessage.Log(Error.Generic, string.Join(\"\\n\", errors)); ", + "\n return Activity.Finish();", "\n}" ], "metadata": {}, @@ -388,7 +574,17 @@ "\n new YieldCurve{ Currency = \"EUR\", Year = 2021, Month = 9, Values = new double[]{4.1,4.2,4.3,4.4,4.5,4.6} },", "\n new YieldCurve{ Currency = \"EUR\", Year = 2016, Month = 3, Values = new double[]{6.1,6.2,6.3,6.4,6.5,6.6} }};", "\n", - "\nawait CheckLoadYieldCurveAsync(args, testData, (2016, 6), 6.1, 0.1, 6.1);" + "\nvar activity = await CheckLoadYieldCurveAsync(args, testData, (2016, 6), 6.1, 0.1, 6.1);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -417,10 +613,11 @@ { "cell_type": "code", "source": [ - "public async Task CheckLoadInterDataNodeParameterAsync(Args args, IEnumerable testData, ", + "public async Task CheckLoadInterDataNodeParameterAsync(Args args, IEnumerable testData, ", "\n int previousYear,", "\n int? currentYear = null)", "\n{", + "\n Activity.Start();", "\n currentYear = currentYear ?? previousYear;", "\n await Workspace.Partition.SetAsync(args);", "\n await Workspace.UpdateAsync(testData);", @@ -500,6 +697,7 @@ "\n Workspace.Reset(x => x.ResetCurrentPartitions());", "\n ", "\n if(errors.Any()) ApplicationMessage.Log(Error.Generic, string.Join(\"\\n\", errors));", + "\n return Activity.Finish();", "\n}" ], "metadata": {}, @@ -517,7 +715,17 @@ "\n new InterDataNodeParameter{ DataNode = gric1, LinkedDataNode = xgic, ReinsuranceCoverage = ((double)previousYear)/1000, Year = previousYear, Month = 3}, ", "\n };", "\n", - "\nawait CheckLoadInterDataNodeParameterAsync(args, testData, previousYear);" + "\nvar activity = await CheckLoadInterDataNodeParameterAsync(args, testData, previousYear);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -538,7 +746,17 @@ "\n new InterDataNodeParameter{ DataNode = gric1, LinkedDataNode = xgic, ReinsuranceCoverage = ((double)currentYear)/1000, Year = currentYear, Month = 9}, ", "\n };", "\n", - "\nawait CheckLoadInterDataNodeParameterAsync(args, testData, previousYear, currentYear);" + "\nvar activity = await CheckLoadInterDataNodeParameterAsync(args, testData, previousYear, currentYear);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -556,7 +774,17 @@ "\n new InterDataNodeParameter{ DataNode = gric1, LinkedDataNode = xgic, ReinsuranceCoverage = ((double)previousYear)/1000, Year = previousYear, Month = 3}, ", "\n };", "\n", - "\nawait CheckLoadInterDataNodeParameterAsync(args, testData, previousYear, currentYear);" + "\nvar activity = await CheckLoadInterDataNodeParameterAsync(args, testData, previousYear, currentYear);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, @@ -574,7 +802,17 @@ "\n new InterDataNodeParameter{ DataNode = gric1, LinkedDataNode = xgic, ReinsuranceCoverage = ((double)currentYear)/1000, Year = currentYear, Month = 3}, ", "\n };", "\n", - "\nawait CheckLoadInterDataNodeParameterAsync(args, testData, previousYear, currentYear);" + "\nvar activity = await CheckLoadInterDataNodeParameterAsync(args, testData, previousYear, currentYear);", + "\nactivity" + ], + "metadata": {}, + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "activity.Status.Should().Be(ActivityLogStatus.Succeeded);" ], "metadata": {}, "execution_count": 0, diff --git a/ifrs17/Utils/ApplicationMessage.ipynb b/ifrs17/Utils/ApplicationMessage.ipynb index e261b4a6..990dd62b 100644 --- a/ifrs17/Utils/ApplicationMessage.ipynb +++ b/ifrs17/Utils/ApplicationMessage.ipynb @@ -56,6 +56,12 @@ "\n public static Object Log (Error e, params string[] s) { log.LogError(Get(e,s)); return null; }", "\n public static Object Log (Warning w, params string[] s) { log.LogWarning(Get(w,s)); return null; }", "\n ", + "\n public static Object Log (ActivityLog activityLog) {", + "\n foreach(var error in activityLog.Errors) log.LogError(error.ToString());", + "\n foreach(var warning in activityLog.Warnings) log.LogWarning(warning.ToString());", + "\n return null;", + "\n }", + "\n ", "\n public static bool HasErrors () => activity.HasErrors();", "\n public static bool HasWarnings () => activity.HasWarnings();", "\n}"