C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
Samples.Injectable.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Diagnostics;
4using System.Linq;
5
6using AnalyzeRe;
19
20namespace AnalyzeReTesting
21{
24 public partial class Samples
25 {
26 #region Dependency Injection Configuration
30
33 maxPollInterval: EnvironmentSettings.POLLING_INTERVAL,
34 maxPollTotalTime: EnvironmentSettings.DATA_UPLOAD_TIMEOUT);
35
38 public static Parameters UploadParams = new Parameters(
39 chunk_timeout: EnvironmentSettings.REQUEST_TIMEOUT,
40 commit_polling_options: DataPollingOptions);
41
43 public void Reset()
44 {
45 typeof(Samples).TypeInitializer.Invoke(null, new object[0]);
46 }
47
56 #endregion Dependency Injection Configuration
57
58 #region Private Dependency Injection Helper Methods
59 private int _injectionNesting;
60
65 {
66 Debug.WriteLine(new string(' ', _injectionNesting) + "Dependency Injection of " +
67 typeof(T).NiceTypeName() + " beginning.");
68 DateTime start = DateTime.UtcNow;
69 _injectionNesting++;
70
71 try
72 {
73 // Invoking getter will have its dependencies injected
75 injected.Mocked = OfflineMode;
76 // ReSharper disable once RedundantAssignment
77 // Getting "Posted" will cause the dependency to be posted immediately.
78 T _ = injected.Posted;
79
80 // Return the original IInjectableResource<T>
81 return injected;
82 }
83 finally
84 {
85 _injectionNesting--;
86 Debug.WriteLine(new string(' ', _injectionNesting) +
87 "Dependency Injection of " + typeof(T).NiceTypeName() +
88 " took " + (DateTime.UtcNow - start).TotalMilliseconds + "ms.");
89 }
90 }
91
96 TypedLockGuard.GetOrCreate(ref cacheProperty, () =>
98
103 TypedLockGuard.GetOrCreate(ref cacheProperty, () =>
105
106 #region TypedLockGuard
113 private static class TypedLockGuard
114 {
118 private static class TypedLockGuardGeneric<T>
119 {
123 private static readonly object CachedResourceLock = new object();
124
126 public static T GetOrCreate(ref T cacheProperty, Func<T> onCreate)
127 {
128 if (cacheProperty != null)
129 return cacheProperty;
130 lock (CachedResourceLock)
131 {
132 if (cacheProperty == null)
134 }
135 return cacheProperty;
136 }
137 }
138
149 }
150 #endregion TypedLockGuard
151
153 private static List<T> ListOfOne<T>(T item) => new List<T> { item };
154 #endregion Private Dependency Injection Helper Methods
155
156 #region Agent Samples
157 [Obsolete("This test resources exists for backwards compatibility testing of an obsolete class.")]
158 private IInjectableResource<Agent> _agent;
159 [Obsolete("This test resources exists for backwards compatibility testing of an obsolete class.")]
160 public IInjectableResource<Agent> Agent => GetOrCreate(ref _agent, () => new Agent
161 {
162 description = "Test Agent 1 Description",
163 meta_data = SampleMetadata,
164 hostname = "Test 1 Hostname"
165 });
166 #endregion Agent Samples
167
168 #region Analysis Samples
169 [Obsolete("This test resources exists for backwards compatibility testing of an obsolete class.")]
170 private IInjectableResource<VendorPortfolioAnalysis> _analysisVendorPortfolioAnalysis;
171 [Obsolete("This test resources exists for backwards compatibility testing of an obsolete class.")]
173 GetOrCreate(ref _analysisVendorPortfolioAnalysis, () => new VendorPortfolioAnalysis
174 {
175 agent = Inject(() => Agent).AsReference,
176 description = "Test VendorPortfolioAnalysis Description",
177 meta_data = SampleMetadata,
178 host = "Test Host",
179 identifier = "Test Identifier",
180 source = "Test Source",
181 vendor = "Test Vendor"
182 });
183
184 [Obsolete("This test resources exists for backwards compatibility testing of an obsolete class.")]
185 private IInjectableResource<VendorTreatyAnalysis> _analysisVendorTreatyAnalysis;
186 [Obsolete("This test resources exists for backwards compatibility testing of an obsolete class.")]
188 GetOrCreate(ref _analysisVendorTreatyAnalysis, () => new VendorTreatyAnalysis
189 {
190 agent = Inject(() => Agent).AsReference,
191 description = "Test VendorTreatyAnalysis Description",
192 meta_data = SampleMetadata,
193 host = "Test Host",
194 identifier = "Test Identifier",
195 source = "Test Source",
196 vendor = "Test Vendor"
197 });
198 #endregion Analysis Samples
199
200 #region AnalysisProfile Samples
201 private IInjectableResource<AnalysisProfile> _analysisProfile;
205 GetOrCreate(ref _analysisProfile, () => new AnalysisProfile
206 {
207 description = "10 Trial Analysis Profile with 8 Filters",
208 meta_data = SampleMetadata,
209 event_catalogs = ListOfOne(Inject(() => EventCatalog).AsReference),
210 exchange_rate_profile = Inject(() => ExchangeRateProfile).AsReference,
211 loss_filters = new List<IReference<LossFilter>>
212 {
213 Inject(() => LossFilter_AnyFilter).AsReference,
214 Inject(() => LossFilter_AndFilter).AsReference,
215 Inject(() => LossFilter_AnyOfFilter).AsReference,
216 Inject(() => LossFilter_OrFilter).AsReference,
217 Inject(() => LossFilter_RangeFilter).AsReference,
218 Inject(() => LossFilter_GTFilter).AsReference,
219 Inject(() => LossFilter_LTFilter).AsReference,
221 },
222 simulation = Inject(() => Simulation_StaticSimulation).AsReference
223 });
224
225 private IInjectableResource<AnalysisProfile> _analysisProfileOneFilter;
231 GetOrCreate(ref _analysisProfileOneFilter, () => new AnalysisProfile
232 {
233 description = "10 Trial Analysis Profile with 1 Filter",
234 meta_data = SampleMetadata,
235 event_catalogs = ListOfOne(Inject(() => EventCatalog).AsReference),
236 exchange_rate_profile = Inject(() => ExchangeRateProfile).AsReference,
238 () => LossFilter_AnyFilter).AsReference),
239 simulation = Inject(() => Simulation_StaticSimulation).AsReference
240 });
241 #endregion AnalysisProfile Samples
242
243 #region Distribution Samples
244 private IInjectableResource<BinomialDistribution> _distributionBinomialDistribution;
245
247 GetOrCreate(ref _distributionBinomialDistribution, () => new BinomialDistribution
248 {
249 description = "Test BinomialDistribution Description",
250 meta_data = SampleMetadata,
251 n = 3,
252 p = 0.5
253 });
254
255 private IInjectableResource<CustomFrequencyDistribution> _distributionCustomFrequencyDistribution;
257 GetOrCreate(ref _distributionCustomFrequencyDistribution, () => new CustomFrequencyDistribution
258 {
259 description = "Test CustomFrequencyDistribution Description",
260 meta_data = SampleMetadata,
261 }, CSV.CustomFrequencyDistribution_Data);
262
263 private IInjectableResource<CustomSeasonalityDistribution> _distributionCustomSeasonalityDistribution;
265 GetOrCreate(ref _distributionCustomSeasonalityDistribution, () => new CustomSeasonalityDistribution
266 {
267 description = "Test CustomSeasonalityDistribution Description",
268 meta_data = SampleMetadata,
269 modulo = 366
270 }, CSV.CustomSeasonalityDistribution_Data);
271
272 private IInjectableResource<CustomSeverityDistribution> _distributionCustomSeverityDistribution;
274 GetOrCreate(ref _distributionCustomSeverityDistribution, () => new CustomSeverityDistribution
275 {
276 description = "Test CustomSeverityDistribution Description",
277 meta_data = SampleMetadata,
278 }, CSV.CustomSeverityDistribution_Data);
279
280 private IInjectableResource<LogNormalDistribution> _distributionLogNormalDistribution;
282 GetOrCreate(ref _distributionLogNormalDistribution, () => new LogNormalDistribution
283 {
284 description = "Test LogNormalDistribution Description",
285 meta_data = SampleMetadata,
286 location = 0.5,
287 scale = 0.4
288 });
289
290 private IInjectableResource<NegativeBinomialDistribution> _distributionNegativeBinomialDistribution;
292 GetOrCreate(ref _distributionNegativeBinomialDistribution, () => new NegativeBinomialDistribution
293 {
294 description = "Test NegativeBinomialDistribution Description",
295 meta_data = SampleMetadata,
296 p = 0.5,
297 r = 2.5
298 });
299
300 private IInjectableResource<NormalDistribution> _distributionNormalDistribution;
302 GetOrCreate(ref _distributionNormalDistribution, () => new NormalDistribution
303 {
304 description = "Test NormalDistribution Description",
305 meta_data = SampleMetadata,
306 mean = 0.5,
307 stddev = 0.4
308 });
309
310 private IInjectableResource<DiracDistribution> _distributionDiracDistribution;
312 GetOrCreate(ref _distributionDiracDistribution, () => new DiracDistribution
313 {
314 description = "Test DiracDistribution Description",
315 meta_data = SampleMetadata,
316 value = 0.85
317 });
318
319 private IInjectableResource<ParetoDistribution> _distributionParetoDistribution;
321 GetOrCreate(ref _distributionParetoDistribution, () => new ParetoDistribution
322 {
323 description = "Test ParetoDistribution Description",
324 meta_data = SampleMetadata,
325 scale = 1.1,
326 shape = 0.9
327 });
328
329 private IInjectableResource<PoissonDistribution> _distributionPoissonDistribution;
331 GetOrCreate(ref _distributionPoissonDistribution, () => new PoissonDistribution
332 {
333 description = "Test PoissonDistribution Description",
334 meta_data = SampleMetadata,
335 mean = 0.5
336 });
337
338 private IInjectableResource<UniformDistribution> _distributionUniformDistribution;
340 GetOrCreate(ref _distributionUniformDistribution, () => new UniformDistribution
341 {
342 description = "Test UniformDistribution Description",
343 meta_data = SampleMetadata,
344 lower = 0.12,
345 upper = 123456.789
346 });
347
348 private IInjectableResource<UniformIntDistribution> _distributionUniformIntDistribution;
350 GetOrCreate(ref _distributionUniformIntDistribution, () => new UniformIntDistribution
351 {
352 description = "Test UniformIntDistribution Description",
353 meta_data = SampleMetadata,
354 lower = 0,
355 upper = 8
356 });
357 #endregion Distribution Samples
358
359 #region EventCatalog Samples
360 private IInjectableResource<EventCatalog> _eventCatalog;
362 GetOrCreate(ref _eventCatalog, () => new EventCatalog
363 {
364 description = "Test EventCatalog 1 Description",
365 meta_data = SampleMetadata,
366 source = "Test 1 Source",
367 tags = ListOfOne("TEST")
368 }, CSV.Event_Catalog_Data);
369 #endregion EventCatalog Samples
370
371 #region ExchangeRateTable Samples
372 private IInjectableResource<ExchangeRateTable> _exchangeRateTable;
374 GetOrCreate(ref _exchangeRateTable, () => new ExchangeRateTable
375 {
376 base_currency = "USD",
377 description = "Test ExchangeRateTable Description",
378 meta_data = SampleMetadata,
379 }, CSV.Exchange_Rate_Table);
380 #endregion ExchangeRateTable Samples
381
382 #region ExchangeRateProfile Samples
383 private IInjectableResource<ExchangeRateProfile> _exchangeRateProfile;
385 GetOrCreate(ref _exchangeRateProfile, () => new ExchangeRateProfile
386 {
387 description = "Test ExchangeRateProfile Description",
388 meta_data = SampleMetadata,
389 exchange_rate_table = Inject(() => ExchangeRateTable).AsReference,
390 rate_selection_order = new List<ExchangeRateSelectionRule>
391 {
393 }
394 });
395 #endregion ExchangeRateProfile Samples
396
397 #region Layer Samples
419
426 .Where(r => !r.UnderlyingType.IsAttributeDefinedFast<NotSaveableAttribute>()).ToList();
427
428 private IInjectableResource<AggXL> _layerAggXL;
430 GetOrCreate(ref _layerAggXL, () => new AggXL
431 {
432 aggregate_attachment = new MonetaryUnit(20000, "USD"),
433 aggregate_limit = new MonetaryUnit(10000000, "USD"),
434 attachment = new MonetaryUnit(10000, "USD"),
435 description = "Test AggXL Description",
436 meta_data = SampleMetadata,
437 expiry_date = SimulationStartDate.AddYears(1),
438 franchise = new MonetaryUnit(100000, "USD"),
439 inception_date = SimulationStartDate,
440 limit = new MonetaryUnit(2000000, "USD"),
441 loss_sets = new List<IReference<LossSet>>
442 {
443 Inject(() => LossSet_ELTLossSet).AsReference,
444 Inject(() => LossSet_YLTLossSet).AsReference
445 },
446 participation = 0.5,
447 premium = new MonetaryUnit(12345.6789, "USD")
448 });
449
450 private IInjectableResource<CatXL> _layerCatXL;
452 GetOrCreate(ref _layerCatXL, () => new CatXL
453 {
454 attachment = new MonetaryUnit(1000000, "USD"),
455 description = "Test CatXL Description",
456 meta_data = SampleMetadata,
457 expiry_date = SimulationStartDate.AddYears(1),
458 franchise = new MonetaryUnit(100000, "USD"),
459 inception_date = SimulationStartDate,
460 limit = new MonetaryUnit(2000000, "USD"),
461 loss_sets = new List<IReference<LossSet>>
462 {
463 Inject(() => LossSet_ELTLossSet).AsReference,
464 Inject(() => LossSet_YELTLossSet).AsReference
465 },
466 nth = 1,
467 participation = 0.987,
468 premium = new MonetaryUnit(12345.6789, "USD"),
469 reinstatements = ListOfOne(Reinstatement)
470 });
471
472 private IInjectableResource<Generic> _layerGeneric;
474 GetOrCreate(ref _layerGeneric, () => new Generic
475 {
476 aggregate_attachment = new MonetaryUnit(20000, "USD"),
477 aggregate_limit = new MonetaryUnit(10000000, "USD"),
478 attachment = new MonetaryUnit(10000, "USD"),
479 description = "Test Generic Description",
480 meta_data = SampleMetadata,
481 expiry_date = SimulationStartDate.AddYears(1),
482 franchise = new MonetaryUnit(100000, "USD"),
483 inception_date = SimulationStartDate,
484 limit = new MonetaryUnit(2000000, "USD"),
485 loss_sets = new List<IReference<LossSet>>
486 {
487 Inject(() => LossSet_ELTLossSet).AsReference,
488 Inject(() => LossSet_YLTLossSet).AsReference,
489 Inject(() => LossSet_YELTLossSet).AsReference
490 },
491 participation = 0.5,
492 premium = new MonetaryUnit(12345.6789, "USD"),
493 reinstatements = ListOfOne(Reinstatement)
494 });
495
496 private IInjectableResource<QuotaShare> _layerQuotaShare;
498 GetOrCreate(ref _layerQuotaShare, () => new QuotaShare
499 {
500 description = "Test QuotaShare Description",
501 meta_data = SampleMetadata,
502 event_limit = new MonetaryUnit(10000000, "USD"),
503 expiry_date = SimulationStartDate.AddYears(1),
504 inception_date = SimulationStartDate,
505 loss_sets = new List<IReference<LossSet>>
506 {
507 Inject(() => LossSet_ELTLossSet).AsReference,
508 Inject(() => LossSet_YELTLossSet).AsReference
509 },
510 participation = 0.5,
511 premium = new MonetaryUnit(12345.6789, "USD")
512 });
513
514 private IInjectableResource<AggregateQuotaShare> _layerAggregateQuotaShare;
516 GetOrCreate(ref _layerAggregateQuotaShare, () => new AggregateQuotaShare
517 {
518 aggregate_attachment = new MonetaryUnit(0, "USD"),
519 aggregate_limit = new MonetaryUnit(10000000, "USD"),
520 description = "Test AggregateQuotaShare Description",
521 meta_data = SampleMetadata,
522 event_limit = new MonetaryUnit(10000000, "USD"),
523 expiry_date = SimulationStartDate.AddYears(1),
524 inception_date = SimulationStartDate,
525 loss_sets = new List<IReference<LossSet>>
526 {
527 Inject(() => LossSet_ELTLossSet).AsReference,
528 Inject(() => LossSet_QCLSLossSet).AsReference
529 },
530 participation = 0.5,
531 premium = new MonetaryUnit(12345.6789, "USD")
532 });
533
534 private IInjectableResource<SurplusShare> _layerSurplusShare;
536 GetOrCreate(ref _layerSurplusShare, () => new SurplusShare
537 {
538 description = "Test SurplusShare Description",
539 meta_data = SampleMetadata,
540 sums_insured = new MonetaryUnit(10000000, "USD"),
541 retained_line = new MonetaryUnit(1000000, "USD"),
542 number_of_lines = 5.5,
543 expiry_date = SimulationStartDate.AddYears(1),
544 inception_date = SimulationStartDate,
545 loss_sets = new List<IReference<LossSet>>
546 {
547 Inject(() => LossSet_ELTLossSet).AsReference,
548 Inject(() => LossSet_LoadedLossSet).AsReference
549 },
550 premium = new MonetaryUnit(12345.6789, "USD")
551 });
552
553 private IInjectableResource<IndustryLossWarranty> _layerIndustryLossWarranty;
555 GetOrCreate(ref _layerIndustryLossWarranty, () => new IndustryLossWarranty
556 {
557 description = "Test IndustryLossWarranty Description",
558 meta_data = SampleMetadata,
559 trigger = new MonetaryUnit(1000, "USD"),
560 payout = new MonetaryUnit(777, "USD"),
561 nth = 1,
562 expiry_date = SimulationStartDate.AddYears(1),
563 inception_date = SimulationStartDate,
564 loss_sets = new List<IReference<LossSet>>
565 {
566 Inject(() => LossSet_ELTLossSet).AsReference,
567 Inject(() => LossSet_QCLSLossSet).AsReference
568 },
569 premium = new MonetaryUnit(123.456, "USD"),
570 participation = 0.5
571 });
572
573 private IInjectableResource<Filter> _layerFilter;
575 GetOrCreate(ref _layerFilter, () => new Filter
576 {
577 description = "Test Filter Description",
578 meta_data = SampleMetadata,
579 invert = false,
580 loss_sets = new List<IReference<LossSet>>
581 {
582 Inject(() => LossSet_ELTLossSet).AsReference,
583 Inject(() => LossSet_YELTLossSet).AsReference
584 },
585 filters = new List<IReference<LossFilter>>
586 {
587 Inject(() => LossFilter_LTFilter).AsReference,
588 Inject(() => LossFilter_AnyOfFilter).AsReference
589 }
590 });
591
592 private IInjectableResource<FixedRateCurrencyConverter> _layerFixedRateCurrencyConverter;
594 GetOrCreate(ref _layerFixedRateCurrencyConverter, () => new FixedRateCurrencyConverter
595 {
596 description = "Test FixedRateCurrencyConverter Description",
597 meta_data = SampleMetadata,
598 in_currency = "USD",
599 out_currency = "CAD",
600 rate = 0.5,
601 loss_sets = new List<IReference<LossSet>>
602 {
603 Inject(() => LossSet_ELTLossSet).AsReference,
604 Inject(() => LossSet_LoadedLossSet).AsReference
605 },
606 });
607
608 private IInjectableResource<LossRank> _layerLossRank;
610 GetOrCreate(ref _layerLossRank, () => new LossRank
611 {
612 description = "Test LossRank Description",
613 meta_data = SampleMetadata,
614 invert = false,
615 count = 10,
616 // criterion = LossRank.Criterion.LargestLoss,
617 loss_sets = new List<IReference<LossSet>>
618 {
619 Inject(() => LossSet_ELTLossSet).AsReference,
620 Inject(() => LossSet_QCLSLossSet).AsReference
621 },
622 });
623
624 private IInjectableResource<NoClaimsBonus> _layerNoClaimsBonus;
626 GetOrCreate(ref _layerNoClaimsBonus, () => new NoClaimsBonus
627 {
628 description = "Test NoClaimsBonus Description",
629 meta_data = SampleMetadata,
630 payout_amount = new MonetaryUnit(1000, "USD"),
631 payout_date = SimulationStartDate.AddDays(100),
632 loss_sets = ListOfOne<IReference<LossSet>>(Inject(() => LossSet_ELTLossSet).AsReference),
633 });
634
635 private IInjectableResource<ValueAllocator> _layerValueAllocator;
637 GetOrCreate(ref _layerValueAllocator, () => new ValueAllocator
638 {
639 description = "Test ValueAllocator Description",
640 meta_data = SampleMetadata,
641 source = Layer_AggXL.AsReference,
642 target = Layer_CatXL.AsReference,
643 group = Layer_Nested.AsReference
644 });
645
646 private IInjectableResource<BackAllocatedLayer> _layerBackAllocatedLayer;
648 GetOrCreate(ref _layerBackAllocatedLayer, () => new BackAllocatedLayer
649 {
650 description = "Test BackAllocatedLayer Description",
651 meta_data = SampleMetadata,
653 // This source id is chosen because we know it is a loss set
654 // appearing in the above Layer_Nested sample resource.
655 source_id = LossSet_ELTLossSet.AsReference.ref_id
656 });
657
658 private IInjectableResource<DelayedPayment> _layerDelayedPayment;
660 GetOrCreate(ref _layerDelayedPayment, () => new DelayedPayment
661 {
662 description = "Test DelayedPayment Description",
663 meta_data = SampleMetadata,
664 loss_sets = ListOfOne<IReference<LossSet>>(Inject(() => LossSet_ELTLossSet).AsReference),
665 payments = new List<DelayedPayment.Payment>
666 {
667 new DelayedPayment.Payment(30d, 0.5),
668 new DelayedPayment.Payment(60d, 0.25),
669 new DelayedPayment.Payment(90d, 0.25)
670 }
671 });
672
673 private IInjectableResource<FixedDatePayment> _layerFixedDatePayment;
675 GetOrCreate(ref _layerFixedDatePayment, () => new FixedDatePayment
676 {
677 description = "Test FixedDatePayment Description",
678 meta_data = SampleMetadata,
679 loss_sets = ListOfOne<IReference<LossSet>>(Inject(() => LossSet_ELTLossSet).AsReference),
680 payments = new List<double> { 0.5, 0.25, 0.25 },
681 payment_dates = Enumerable.Range(0, 8).Select(i =>
682 SimulationStartDate.AddMonths(i * 3)).ToList()
683 });
684
685 #region Nested Layer Samples
686 private IInjectableResource<Nested> _layerNested;
689 TypedLockGuard.GetOrCreate(ref _layerNested, () => GetInjectableNestedLayer(Layer_AggXL,
691
701 bool inline = false)
702 {
703 IReference<ILayerSource> sink_reference = inline ? sink.AsInlinedReference : sink.AsReference;
705 .Select(source => inline ? source.AsInlinedReference : source.AsReference);
706
707 return InjectableResource.Create(new Nested
708 {
709 description = $"Sample Nested with a " +
710 $"{sink_reference.ResourceType.NiceTypeName()} sink " +
711 $"and {readySources.Count()} source layers.",
712 meta_data = SampleMetadata,
713 sink = sink_reference,
714 sources = new Nested.Sources(readySources)
715 }, OfflineMode);
716 }
717 #endregion Nested Layer Samples
718 #endregion Layer Samples
719
720 #region LayerView Samples
721
743
744 private IInjectableResource<ILayerView<AggXL>> _layerViewAggXL;
746 TypedLockGuard.GetOrCreate(ref _layerViewAggXL,
748
749 private IInjectableResource<ILayerView<CatXL>> _layerViewCatXL;
751 TypedLockGuard.GetOrCreate(ref _layerViewCatXL,
753
754 private IInjectableResource<ILayerView<Generic>> _layerViewGeneric;
756 TypedLockGuard.GetOrCreate(ref _layerViewGeneric,
758
759 private IInjectableResource<ILayerView<QuotaShare>> _layerViewQuotaShare;
761 TypedLockGuard.GetOrCreate(ref _layerViewQuotaShare,
763
764 private IInjectableResource<ILayerView<AggregateQuotaShare>> _layerViewAggregateQuotaShare;
766 TypedLockGuard.GetOrCreate(ref _layerViewAggregateQuotaShare,
768
769 private IInjectableResource<ILayerView<SurplusShare>> _layerViewSurplusShare;
771 TypedLockGuard.GetOrCreate(ref _layerViewSurplusShare,
773
774 private IInjectableResource<ILayerView<IndustryLossWarranty>> _layerViewIndustryLossWarranty;
776 TypedLockGuard.GetOrCreate(ref _layerViewIndustryLossWarranty,
778
779 private IInjectableResource<ILayerView<Nested>> _layerViewNested;
781 TypedLockGuard.GetOrCreate(ref _layerViewNested,
783
784 private IInjectableResource<ILayerView<Filter>> _layerViewFilter;
786 TypedLockGuard.GetOrCreate(ref _layerViewFilter, () =>
787 {
788 // Need to ensure that the LossFilter in the Filter layer comes from
789 // the analysis profile for it to be valid.
791 Inject(() => AnalysisProfile);
793 // Use the LessThanFilter (also used to create the analysis profile) so it has an effect
794 modifiedFilter.filters.Clear();
795 modifiedFilter.filters.Add(Inject(() => LossFilter_LTFilter).AsReference);
796 return InjectableResource.Create(
798 });
799
800 private IInjectableResource<ILayerView<FixedRateCurrencyConverter>> _layerViewFixedRateCurrencyConverter;
802 TypedLockGuard.GetOrCreate(ref _layerViewFixedRateCurrencyConverter,
804 target_currency: "CAD"));
805
806 private IInjectableResource<ILayerView<LossRank>> _layerViewLossRank;
808 TypedLockGuard.GetOrCreate(ref _layerViewLossRank,
810
811 private IInjectableResource<ILayerView<NoClaimsBonus>> _layerViewNoClaimsBonus;
813 TypedLockGuard.GetOrCreate(ref _layerViewNoClaimsBonus,
815
816 private IInjectableResource<ILayerView<ValueAllocator>> _layerViewValueAllocator;
818 TypedLockGuard.GetOrCreate(ref _layerViewValueAllocator,
820
821 private IInjectableResource<ILayerView<BackAllocatedLayer>> _layerViewBackAllocatedLayer;
823 TypedLockGuard.GetOrCreate(ref _layerViewBackAllocatedLayer,
825
826 private IInjectableResource<ILayerView<DelayedPayment>> _layerViewDelayedPayment;
828 TypedLockGuard.GetOrCreate(ref _layerViewDelayedPayment,
830
831 private IInjectableResource<ILayerView<FixedDatePayment>> _layerViewFixedDatePayment;
833 TypedLockGuard.GetOrCreate(ref _layerViewFixedDatePayment,
835
836 #region Injectable LayerView Factories
847 string target_currency = null)
848 where T : ILayer
849 {
850 if (analysisProfile == null)
852 return GetInjectableLayerView(layer.Unposted, analysisProfile, target_currency);
853 }
854
864 string target_currency = null)
865 where T : ILayer
866 {
867 if (analysisProfile == null)
869 return InjectableResource.Create(
870 LayerViews.Create(layer, analysisProfile.AsReference, target_currency), OfflineMode);
871 }
872 #endregion Injectable LayerView Factories
873 #endregion LayerView Samples
874
875 #region LossFilter Samples
876 private IInjectableResource<AndFilter> _lossFilterAndFilter;
878 GetOrCreate(ref _lossFilterAndFilter, () => new AndFilter
879 {
880 description = "Test AndFilter Description",
881 meta_data = SampleMetadata,
882 invert = false,
883 name = "Test AndFilter Name",
884 expressions = new List<IReference<LossFilter>>
885 {
886 Inject(() => LossFilter_GTFilter).AsReference,
887 Inject(() => LossFilter_AnyOfFilter).AsReference
888 }
889 });
890
891 private IInjectableResource<AnyFilter> _lossFilterAnyFilter;
893 GetOrCreate(ref _lossFilterAnyFilter, () => new AnyFilter
894 {
895 description = "Test AnyFilter Description",
896 meta_data = SampleMetadata,
897 invert = false,
898 name = "Test AnyFilter Name"
899 });
900
901 private IInjectableResource<AnyOfFilter> _lossFilterAnyOfFilter;
903 GetOrCreate(ref _lossFilterAnyOfFilter, () => new AnyOfFilter
904 {
905 description = "Test AnyOfFilter Description",
906 meta_data = SampleMetadata,
907 invert = false,
908 name = "Test AnyOfFilter Name",
909 attribute = "Attribute1",
910 values = new List<object> { "A", "B" }
911 });
912
913 private IInjectableResource<RecordTypeAnyOfFilter> _lossFilterRecordTypeAnyOfFilter;
915 GetOrCreate(ref _lossFilterRecordTypeAnyOfFilter, () => new RecordTypeAnyOfFilter
916 {
917 description = "Test RecordTypeAnyOfFilter Description",
918 meta_data = SampleMetadata,
919 invert = false,
920 name = "Test RecordTypeAnyOfFilter Name",
921 values = new List<RecordType> { RecordType.Loss, RecordType.FixedExpense }
922 });
923
924 private IInjectableResource<GTFilter> _lossFilterGTFilter;
926 GetOrCreate(ref _lossFilterGTFilter, () => new GTFilter
927 {
928 description = "Test GTFilter Description",
929 meta_data = SampleMetadata,
930 invert = false,
931 name = "Test GTFilter Name",
932 attribute = "NumericAttribute",
933 inclusive = true,
934 value = 15.0
935 });
936
937 private IInjectableResource<LTFilter> _lossFilterLTFilter;
939 GetOrCreate(ref _lossFilterLTFilter, () => new LTFilter
940 {
941 description = "Test LTFilter Description",
942 meta_data = SampleMetadata,
943 invert = false,
944 name = "Test LTFilter Name",
945 attribute = "NumericAttribute",
946 inclusive = false,
947 value = 15.0
948 });
949
950 private IInjectableResource<OrFilter> _lossFilterOrFilter;
952 GetOrCreate(ref _lossFilterOrFilter, () => new OrFilter
953 {
954 description = "Test OrFilter Description",
955 meta_data = SampleMetadata,
956 invert = false,
957 name = "Test OrFilter Name",
958 expressions = new List<IReference<LossFilter>>
959 {
960 Inject(() => LossFilter_GTFilter).AsReference,
961 Inject(() => LossFilter_AnyOfFilter).AsReference
962 }
963 });
964
965 private IInjectableResource<RangeFilter> _lossFilterRangeFilter;
967 GetOrCreate(ref _lossFilterRangeFilter, () => new RangeFilter
968 {
969 description = "Test RangeFilter Description",
970 meta_data = SampleMetadata,
971 invert = false,
972 name = "Test RangeFilter Name",
973 attribute = "NumericAttribute",
974 begin_inclusive = true,
975 end_inclusive = false,
976 begin_value = 5.0,
977 end_value = 20.0
978 });
979 #endregion LossFilter Samples
980
981 #region LossSet Samples
994
995 private IInjectableResource<ELTLossSet> _lossSetELTLossSet;
997 GetOrCreate(ref _lossSetELTLossSet, () => new ELTLossSet
998 {
999 currency = "USD",
1000 description = "Test LossSet Description",
1001 meta_data = SampleMetadata,
1002 event_catalogs = ListOfOne(Inject(() => EventCatalog).AsReference)
1003 }, CSV.Loss_Set_1_Data);
1004
1005 [Obsolete("This test resources exists for backwards compatibility testing of an obsolete class.")]
1006 private IInjectableResource<TreatyLossSet> _lossSetTreatyLossSet;
1007 [Obsolete("This test resources exists for backwards compatibility testing of an obsolete class.")]
1009 GetOrCreate(ref _lossSetTreatyLossSet, () => new TreatyLossSet
1010 {
1011 currency = "USD",
1012 description = "Test TreatyLossSet Description",
1013 meta_data = SampleMetadata,
1014 event_catalogs = ListOfOne(Inject(() => EventCatalog).AsReference),
1015 analysis = Inject(() => Analysis_VendorTreatyAnalysis).AsReference,
1016 treaty = new TreatyLossSet.Treaty { id = "1", description = "Test Treaty" }
1017 }, CSV.Loss_Set_2_Data);
1018
1019 [Obsolete("This test resources exists for backwards compatibility testing of an obsolete class.")]
1020 private IInjectableResource<PortfolioLossSet> _lossSetPortfolioLossSet;
1021 [Obsolete("This test resources exists for backwards compatibility testing of an obsolete class.")]
1023 GetOrCreate(ref _lossSetPortfolioLossSet, () => new PortfolioLossSet
1024 {
1025 currency = "USD",
1026 description = "Test PortfolioLossSet Description",
1027 meta_data = SampleMetadata,
1028 event_catalogs = ListOfOne(Inject(() => EventCatalog).AsReference),
1029 analysis = Inject(() => Analysis_VendorPortfolioAnalysis).AsReference,
1030 perspective = "AB"
1031 }, CSV.Loss_Set_3_Data);
1032
1033 #region NestedLayerLossSet Samples
1034 [Obsolete("This test resources exists for backwards compatibility testing of an obsolete class.")]
1035 private IInjectableResource<NestedLayerLossSet> _lossSetNestedLayerLossSet;
1037 [Obsolete("This test resources exists for backwards compatibility testing of an obsolete class.")]
1039 _lossSetNestedLayerLossSet ??
1040 (_lossSetNestedLayerLossSet = GetInjectableNestedLayerLossSet(Layer_CatXL));
1041
1048 [Obsolete("This test helper exists for backwards compatibility testing of an obsolete class.")]
1050 IInjectableResource<ILayer> layer, LossType? loss_type = null)
1051 {
1052 return InjectableResource.Create(new NestedLayerLossSet
1053 {
1054 description = "Sample NestedLayerLossSet for " +
1055 layer.UnderlyingType.NiceTypeName(),
1056 meta_data = SampleMetadata,
1057 loss_type = loss_type,
1058 layer = Inject(() => layer).AsReference
1059 }, OfflineMode);
1060 }
1061 #endregion NestedLayerLossSet Samples
1062
1063 private IInjectableResource<ParametricLossSet> _lossSetParametricLossSet;
1065 GetOrCreate(ref _lossSetParametricLossSet, () => new ParametricLossSet
1066 {
1067 currency = "USD",
1068 description = "Test ParametricLossSet Description",
1069 meta_data = SampleMetadata,
1070 attributes = new Dictionary<string, string> { { "Test", "Test Attribute" } },
1071 frequency = Inject(() => Distribution_UniformIntDistribution).AsReference,
1072 seasonality = Inject(() => Distribution_NormalDistribution).AsReference,
1073 severity = Inject(() => Distribution_UniformDistribution).AsReference,
1074 start_date = SimulationStartDate,
1075 event_id = 20
1076 });
1077
1078 #region YELTLossSet Samples
1081 string currency = "USD", string data = null, LossType lossType = LossType.LossGross)
1082 {
1083 return InjectableResource.Create(new YELTLossSet
1084 {
1086 description = "Test YELTLossSet Description",
1087 meta_data = SampleMetadata,
1088 event_catalogs = ListOfOne(Inject(() => EventCatalog).AsReference),
1089 trial_count = 10,
1090 start_date = SimulationStartDate,
1091 loss_type = lossType
1093 }
1094
1095 private IInjectableResource<YELTLossSet> _lossSetYELTLossSet;
1097 TypedLockGuard.GetOrCreate(ref _lossSetYELTLossSet, () => GetInjectableYELT());
1098
1099 private IInjectableResource<YELTLossSet> _lossSetYELTLossSetWithReinstatements;
1101 TypedLockGuard.GetOrCreate(ref _lossSetYELTLossSetWithReinstatements,
1102 () => GetInjectableYELT(data: CSV.YELTLossSet_WithReinstatements_10Trials,
1104 #endregion YELTLossSet Samples
1105
1106 #region YLTLossSet Samples
1109 string data = null, LossType lossType = LossType.LossGross)
1110 {
1111 return InjectableResource.Create(new YLTLossSet
1112 {
1113 attributes = new Dictionary<string, string> { { "Test", "Test Attribute" } },
1114 currency = "USD",
1115 description = "Test YLTLossSet Description",
1116 meta_data = SampleMetadata,
1117 start_date = SimulationStartDate,
1118 trial_count = 10,
1119 loss_type = lossType
1120 }, data ?? CSV.YLTLossSet_10Trials, OfflineMode);
1121 }
1122
1123 private IInjectableResource<YLTLossSet> _lossSetYLTLossSet;
1125 TypedLockGuard.GetOrCreate(ref _lossSetYLTLossSet, () => GetInjectableYLT());
1126
1127 private IInjectableResource<YLTLossSet> _lossSetYLTLossSetWithReinstatements;
1129 TypedLockGuard.GetOrCreate(ref _lossSetYLTLossSetWithReinstatements,
1131 LossType.LossNetOfAggregateTerms));
1132 #endregion YLTLossSet Samples
1133
1134 #region LoadedLossSet Samples
1135 private IInjectableResource<LoadedLossSet> _lossSetLoadedLossSet;
1138 TypedLockGuard.GetOrCreate(ref _lossSetLoadedLossSet, () =>
1140
1149 IInjectableResource<LossSet> source, double load = 1.0, LossType? loss_type = null)
1150 {
1151 return InjectableResource.Create(new LoadedLossSet
1152 {
1153 description = "Sample LoadedLossSet for " +
1154 source.UnderlyingType.NiceTypeName(),
1155 meta_data = SampleMetadata,
1156 load = load,
1157 loss_type = loss_type,
1158 source = Inject(() => source).AsReference
1159 }, OfflineMode);
1160 }
1161 #endregion LoadedLossSet Samples
1162
1163 private IInjectableResource<QCLSLossSet> _lossSetQCLSLossSet;
1165 GetOrCreate(ref _lossSetQCLSLossSet, () => new QCLSLossSet
1166 {
1167 currency = "USD",
1168 description = "Test QCLSLossSet Description",
1169 meta_data = SampleMetadata,
1170 correlation_coefficient = 0.5,
1171 distribution = Inject(() => Distribution_CustomSeverityDistribution).AsReference,
1172 simulation = Inject(() => Simulation_StaticSimulation).AsReference
1173 });
1174 #endregion LossSet Samples
1175
1176 #region OptimizationView Samples
1181 {
1182 {"Discretization", 0.0001},
1183 {"Objective 1 - Function", "expected_return"},
1184 {"Objective 1 - Name", "Expected Return"},
1185 {"Objective 1 - Type", "max"},
1186 {"Objective 1 - Return Period", ""},
1187 {"Objective 1 - Loss Perspective", "losses_net_premium"},
1188
1189 {"Objective 2 - Function", "tail_value_at_risk"},
1190 {"Objective 2 - Name", "Tail Value at Risk"},
1191 {"Objective 2 - Type", "max"},
1192 {"Objective 2 - Return Period", 0.01},
1193 {"Objective 2 - Loss Perspective", "losses_net_premium"},
1194
1195 {"Constraint 1 - Function", "el_capital_ratio"},
1196 {"Constraint 1 - Name", "EL-Capital Ratio"},
1197 {"Constraint 1 - Min", ""},
1198 {"Constraint 1 - Max", 0.8},
1199 {"Constraint 1 - Return Period", ""},
1200 {"Constraint 1 - Loss Perspective", ""},
1201 {"Constraint 1 - Capital Load", 1.5},
1202
1203 {"Constraint 2 - Function", "florida_limit_total_limit_ratio"},
1204 {"Constraint 2 - Min", ""},
1205 {"Constraint 2 - Max", 0.5},
1206 {"Constraint 2 - Return Period", ""},
1207 {"Constraint 2 - Loss Perspective", ""},
1208
1209 {"Constraint 3 - Function", 2},
1210 {"Constraint 3 - Min", -10000},
1211 {"Constraint 3 - Max", ""},
1212 {"Constraint 3 - Return Period", ""},
1213 {"Constraint 3 - Loss Perspective", ""}
1214 };
1215
1218 {
1219 List<DomainEntry> domains = layers.Select(l => new DomainEntry
1220 {
1221 layer = Inject(() => l).AsReference,
1222 min = 0,
1223 max = 1
1224 }).ToList();
1225 return InjectableResource.Create(new OptimizationView
1226 {
1227 description = "Test Optimization Description",
1228 meta_data = SampleMetadata,
1229 analysis_profile = Inject(() => AnalysisProfile).AsReference,
1230 population_size = 5,
1231 iterations = 10,
1232 custom_parameters = OptimizationView_CustomParameters,
1233 domains = domains
1234 }, OfflineMode);
1235 }
1236 private IInjectableResource<OptimizationView> _optimizationViewSimulated;
1238 TypedLockGuard.GetOrCreate(ref _optimizationViewSimulated, () =>
1240 #endregion OptimizationView Samples
1241
1242 #region Optimization Function Samples
1243 private IInjectableResource<ProjectionFunction> _projectionFunction;
1246 GetOrCreate(ref _projectionFunction, () => new ProjectionFunction
1247 {
1248 description = "Round the value to the nearest \"step\".",
1249 name = "Unique Name " + Guid.NewGuid(),
1250 src =
1251 "step == 0.0 && return member.variables[:shares]" +
1252 "" +
1253 "return Float64[discretize_value(value, step, min, max)" +
1254 " for (value, min, max) in" +
1255 " zip(member.variables[:shares], mins, maxes)]" +
1256 "",
1257 arguments_schema = new Dictionary<string, object>
1258 {
1259 { "type", "object" },
1260 {
1261 "properties", new Dictionary<string, object>
1262 {
1263 { "step", new Dictionary<string, object> { { "type", "number" } } },
1264 { "min", new Dictionary<string, object> { { "type", "number" } } },
1265 { "max", new Dictionary<string, object> { { "type", "number" } } }
1266 }
1267 }
1268 }
1269 });
1270
1272 private IInjectableResource<MetricsFunction> _metricsFunction;
1274 GetOrCreate(ref _metricsFunction, () => new MetricsFunction
1275 {
1276 description = "Round the value to the nearest \"step\".",
1277 name = "Unique Name " + Guid.NewGuid(),
1278 src =
1279 "step == 0.0 && return member.variables[:shares]" +
1280 "" +
1281 "return Float64[discretize_value(value, step, min, max)" +
1282 " for (value, min, max) in" +
1283 " zip(member.variables[:shares], mins, maxes)]" +
1284 "",
1285 arguments_schema = new Dictionary<string, object>
1286 {
1287 { "type", "object" },
1288 {
1289 "properties", new Dictionary<string, object>
1290 {
1291 { "step", new Dictionary<string, object> { { "type", "number" } } },
1292 { "min", new Dictionary<string, object> { { "type", "number" } } },
1293 { "max", new Dictionary<string, object> { { "type", "number" } } }
1294 }
1295 }
1296 }
1297 });
1298 #endregion Optimization Function Samples
1299
1300 #region Portfolio Samples
1301 private IInjectableResource<StaticPortfolio> _portfolio;
1303 GetOrCreate(ref _portfolio, () => new StaticPortfolio
1304 {
1305 description = "Test StaticPortfolio 1 Description",
1306 meta_data = SampleMetadata,
1307 layers = new HashSet<IReference<ILayer>>
1308 {
1309 Inject(() => Layer_CatXL).AsReference,
1310 Inject(() => Layer_AggXL).AsReference,
1311 Inject(() => Layer_QuotaShare).AsReference
1312 },
1313 name = "Test StaticPortfolio 1 Name"
1314 });
1315 #endregion Portfolio Samples
1316
1317 #region PortfolioView Samples
1318 private IInjectableResource<PortfolioView> _portfolioViewWithPortfolio;
1320 TypedLockGuard.GetOrCreate(ref _portfolioViewWithPortfolio, () =>
1322
1323 private IInjectableResource<PortfolioView> _portfolioViewWithLayerViews;
1325 TypedLockGuard.GetOrCreate(ref _portfolioViewWithLayerViews, () =>
1326 {
1327 return InjectableResource.Create(new PortfolioView
1328 {
1329 analysis_profile = AnalysisProfile.AsReference,
1330 layer_views = new HashSet<IReference<ILayerView>>
1331 {
1332 Inject(() => LayerView_CatXL).AsReference,
1333 Inject(() => LayerView_AggXL).AsReference,
1334 Inject(() => LayerView_AggregateQuotaShare).AsReference
1335 }
1336 }, OfflineMode);
1337 });
1338
1339 #region Injectable PortfolioView Factories
1349 string target_currency = null)
1350 {
1351 return InjectableResource.Create(new PortfolioView
1352 {
1353 portfolio = Inject(() => portfolio).AsReference,
1354 analysis_profile = Inject(() => analysisProfile).AsReference,
1355 target_currency = target_currency
1356 }, OfflineMode);
1357 }
1358 #endregion Injectable PortfolioView Factories
1359 #endregion PortfolioView Samples
1360
1361 #region Simulation Samples
1362 #region StaticSimulation
1363 private IInjectableResource<StaticSimulation> _simulationStaticSimulation;
1365 GetOrCreate(ref _simulationStaticSimulation, () => new StaticSimulation
1366 {
1367 description = "Test Simulation 1 Description",
1368 meta_data = SampleMetadata,
1369 event_catalogs = ListOfOne(Inject(() => EventCatalog).AsReference),
1370 name = "Test Simulation 1 Name",
1371 trial_count = 10,
1372 start_date = SimulationStartDate
1373 }, CSV.Static_Simulation_Data);
1374 #endregion StaticSimulation
1375 #endregion Simulation Samples
1376 }
1377}
A class containing a resource that can be Posted with dependencies.
Exposes the various sample CSV files as strings.
Definition Samples.CSV.cs:9
static string YLTLossSet_WithReinstatements_10Trials
static string YELTLossSet_10Trials
static string YLTLossSet_10Trials
Exposes sample resource objects, with built-in methods for injecting dependencies.
Definition Samples.cs:14
IInjectableResource< NegativeBinomialDistribution > Distribution_NegativeBinomialDistribution
IInjectableResource< CustomSeasonalityDistribution > Distribution_CustomSeasonalityDistribution
IInjectableResource< ILayerView< FixedDatePayment > > LayerView_FixedDatePayment
static readonly PollingOptions DataPollingOptions
Polling options to use when uploading a data file.
IInjectableResource< RangeFilter > LossFilter_RangeFilter
List< IInjectableResource< ILayerView > > AllLayerViewTypesTestList
A list of one of each type of layer.
static Parameters UploadParams
The LargeDataUpload parameters to use when uploading data for test fixtures.
IInjectableResource< YELTLossSet > LossSet_YELTLossSet
IInjectableResource< Nested > Layer_Nested
A simple nested layer retaining a CatXL source's losses to an AggXL sink.
IInjectableResource< SurplusShare > Layer_SurplusShare
IInjectableResource< ILayerView< DelayedPayment > > LayerView_DelayedPayment
IInjectableResource< ILayerView< Generic > > LayerView_Generic
IInjectableResource< ILayerView< AggXL > > LayerView_AggXL
IInjectableResource< PoissonDistribution > Distribution_PoissonDistribution
IInjectableResource< ELTLossSet > LossSet_ELTLossSet
IInjectableResource< StaticSimulation > Simulation_StaticSimulation
IInjectableResource< NormalDistribution > Distribution_NormalDistribution
IInjectableResource< ILayerView< BackAllocatedLayer > > LayerView_BackAllocatedLayer
IInjectableResource< AggXL > Layer_AggXL
IInjectableResource< YLTLossSet > GetInjectableYLT(string data=null, LossType lossType=LossType.LossGross)
Helper function for creating a YLT Loss Set with a specific configuration.
IInjectableResource< ILayerView< Nested > > LayerView_Nested
IInjectableResource< ILayerView< QuotaShare > > LayerView_QuotaShare
IInjectableResource< Generic > Layer_Generic
IInjectableResource< ILayerView< FixedRateCurrencyConverter > > LayerView_FixedRateCurrencyConverter
List< IInjectableResource< ILayer > > AllSaveableLayerTypesTestList
A list of one of each type of layer that can be POSTed. Layer types that cannot be posted on their ow...
IInjectableResource< OrFilter > LossFilter_OrFilter
IInjectableResource< LogNormalDistribution > Distribution_LogNormalDistribution
IInjectableResource< CustomSeverityDistribution > Distribution_CustomSeverityDistribution
IInjectableResource< ILayerView< NoClaimsBonus > > LayerView_NoClaimsBonus
Dictionary< string, object > OptimizationView_CustomParameters
A sample acceptable optimization_view custom_parameters dictionary.
IInjectableResource< BackAllocatedLayer > Layer_BackAllocatedLayer
IInjectableResource< NestedLayerLossSet > LossSet_NestedLayerLossSet
A simple NestedLayerLossSet retaining a CatXL layer's losses.
IInjectableResource< IndustryLossWarranty > Layer_IndustryLossWarranty
IInjectableResource< UniformDistribution > Distribution_UniformDistribution
IInjectableResource< ILayerView< Filter > > LayerView_Filter
IInjectableResource< ILayerView< LossRank > > LayerView_LossRank
IInjectableResource< LoadedLossSet > LossSet_LoadedLossSet
A simple LoadedLossSet loading a ELTLossSets losses.
static Dictionary< string, object > SampleMetadata
Definition Samples.cs:43
IInjectableResource< QCLSLossSet > LossSet_QCLSLossSet
IInjectableResource< VendorTreatyAnalysis > Analysis_VendorTreatyAnalysis
IInjectableResource< YELTLossSet > LossSet_YELTLossSetWithReinstatements
IInjectableResource< NestedLayerLossSet > GetInjectableNestedLayerLossSet(IInjectableResource< ILayer > layer, LossType? loss_type=null)
Factory for producing injectable NestedLayerLossSets using a POSTable injectable Layer for use in tes...
IInjectableResource< TreatyLossSet > LossSet_TreatyLossSet
IInjectableResource< LossRank > Layer_LossRank
IInjectableResource< ParametricLossSet > LossSet_ParametricLossSet
IInjectableResource< ParetoDistribution > Distribution_ParetoDistribution
IInjectableResource< ILayerView< SurplusShare > > LayerView_SurplusShare
IInjectableResource< PortfolioView > PortfolioView_WithLayerViews
IInjectableResource< AndFilter > LossFilter_AndFilter
IInjectableResource< AggregateQuotaShare > Layer_AggregateQuotaShare
IInjectableResource< VendorPortfolioAnalysis > Analysis_VendorPortfolioAnalysis
IInjectableResource< UniformIntDistribution > Distribution_UniformIntDistribution
IInjectableResource< DiracDistribution > Distribution_DiracDistribution
IInjectableResource< ValueAllocator > Layer_ValueAllocator
IInjectableResource< ILayerView< T > > GetInjectableLayerView< T >(IInjectableResource< T > layer, IInjectableResource< AnalysisProfile > analysisProfile=null, string target_currency=null)
Factory for producing injectable LayerViews using a Layer and a injectable AnalysisProfile for use in...
IInjectableResource< BinomialDistribution > Distribution_BinomialDistribution
DateTime SimulationStartDate
The relative start_date to use for all new resources that require an absolute DateTime point of refer...
IInjectableResource< CatXL > Layer_CatXL
List< IInjectableResource< LossSet > > AllLossSetTypesTestList
One sample of each loss set type, all with the loss_type set to LossType.LossGross to maximize potent...
List< IInjectableResource< ILayer > > AllLayerTypesTestList
A list of one of each type of layer.
IInjectableResource< Filter > Layer_Filter
IInjectableResource< LTFilter > LossFilter_LTFilter
IInjectableResource< Nested > GetInjectableNestedLayer(IInjectableResource< ILayerSource > sink, IEnumerable< IInjectableResource< ILayerSource > > sources, bool inline=false)
Factory for producing injectable NestedLayers using a POSTable injectable Layer for use in testing.
IInjectableResource< YLTLossSet > LossSet_YLTLossSet
IInjectableResource< ILayerView< IndustryLossWarranty > > LayerView_IndustryLossWarranty
IInjectableResource< LoadedLossSet > GetInjectableLoadedLossSet(IInjectableResource< LossSet > source, double load=1.0, LossType? loss_type=null)
Factory for producing injectable LoadedLossSets using a POSTable injectable Layer for use in testing.
void Reset()
Reset all cached injected resources.
IInjectableResource< ILayerView< CatXL > > LayerView_CatXL
IInjectableResource< AnalysisProfile > AnalysisProfile_OneFilter
An analysis profile containing only an AnyFilter.
IInjectableResource< AnyFilter > LossFilter_AnyFilter
IInjectableResource< FixedDatePayment > Layer_FixedDatePayment
IInjectableResource< OptimizationView > GetInjectableOptimizationView(IEnumerable< IInjectableResource< Layer > > layers)
IInjectableResource< ILayerView< AggregateQuotaShare > > LayerView_AggregateQuotaShare
IInjectableResource< YELTLossSet > GetInjectableYELT(string currency="USD", string data=null, LossType lossType=LossType.LossGross)
Helper function for creating a YELT Loss Set with a specific configuration.
IInjectableResource< YLTLossSet > LossSet_YLTLossSetWithReinstatements
IInjectableResource< QuotaShare > Layer_QuotaShare
IInjectableResource< DelayedPayment > Layer_DelayedPayment
IInjectableResource< GTFilter > LossFilter_GTFilter
IInjectableResource< RecordTypeAnyOfFilter > LossFilter_RecordTypeAnyOfFilter
IInjectableResource< AnyOfFilter > LossFilter_AnyOfFilter
IInjectableResource< CustomFrequencyDistribution > Distribution_CustomFrequencyDistribution
IInjectableResource< ILayerView< ValueAllocator > > LayerView_ValueAllocator
IInjectableResource< PortfolioLossSet > LossSet_PortfolioLossSet
bool OfflineMode
Can be set to true to avoid POSTing resources, and instead injecting mock resources with invalid ids ...
IInjectableResource< OptimizationView > OptimizationView_Simulated
IInjectableResource< FixedRateCurrencyConverter > Layer_FixedRateCurrencyConverter
IInjectableResource< NoClaimsBonus > Layer_NoClaimsBonus
IInjectableResource< PortfolioView > PortfolioView_WithPortfolio
IInjectableResource< PortfolioView > GetInjectablePortfolioView(IInjectableResource< StaticPortfolio > portfolio, IInjectableResource< AnalysisProfile > analysisProfile, string target_currency=null)
Factory for producing injectable PortfolioViews using a Portfolio and a injectable AnalysisProfile fo...
Retrieve settings from environment variables if they exist, or the project settings file otherwise.
static bool RUN_OFFLINE
Controls whether tests that normally require a connection to the server should be allowed to try to r...
Describes a collection of resources which can be listed.
Represents a DataAgent instance.
Definition Agent.cs:12
Represents the metadata for a VendorPortfolioAnalysis entity imported from a vendor.
Represents the metadata for a VendorTreatyAnalysis entity imported from a vendor.
A configuration of resources used to simulate a layer or portfolio.
Indicates that while the current APIResource-derived class can be constructed and potentially inlined...
Describes a Binomial Discrete Distribution.
Custom Distribution that describes a parametric loss set's frequency.
Custom Distribution that describes a parametric loss set's seasonality.
Custom Distribution that describes a parametric loss set's severity.
Describes a distribution that always returns the same value. This distribution can be used as either ...
Describes a LogNormal Continuous Distribution.
Describes a NegativeBinomial Discrete Distribution.
Describes a Normal Continuous Distribution.
Describes a Pareto Probability Distribution.
Describes a Poisson Discrete Distribution.
Describes a Continuous Uniform Distribution, also known as a rectangular distribution,...
Describes a Discrete Uniform Distribution, also known as a rectangular distribution,...
Representation of an event catalog. The event catalog may cover multiple region/perils,...
A rule indicating that the latest available exchange rate should be used.
A profile describing how to apply exchange rates during an analysis.
A table containing exchange rate information.
Parameters to be used in a Large Data Upload operation.
Definition Parameters.cs:7
LayerView factory class.
Definition LayerViews.cs:9
Representation of an Aggregate Catastrophe Excess of Loss layer.
Definition AggXL.cs:8
Representation of a Quota Share contract that is limited in annual payouts.
Acts as a replacement for IAPIResourceView.back_allocations. Computes the proportion of some sink str...
Representation of a Catastrophe Excess of Loss (CatXL) layer.
Definition CatXL.cs:9
Describes a single payment, which consists of a delay and fracational amount.
A "delayed payment" payment pattern models claims being paid in instalments at fixed delays after the...
Filter is like a layer whose 'terms' are to filter events out of the loss sources....
Definition Filter.cs:13
A "delayed payment" payment pattern models claims being paid in instalments at specific dates followi...
A structure that can be used to change the currency of a loss stream from one currency to another at ...
Representation of an Aggregate Catastrophe Excess of Loss layer with reinstatements.
Definition Generic.cs:10
Representation of an Industry Loss Warranty, which is a layer that triggers a payout (currently expre...
The LossRank layer allows one to select a subset of occurrences in a trial year based on the relative...
Definition LossRank.cs:12
A wrapper for a List<T> of IReference<ILayerSource> references that simplifies the construction and u...
Definition Nested.cs:67
Allows one or more source layers or layer_views to be attached as loss sources to some other layer de...
Definition Nested.cs:22
The No Claims Bonus applies a payout to trials which contain no losses. (i.e. when there are no occur...
Representation of a Quota Share contract.
Definition QuotaShare.cs:9
Represents a reinstatement premium and brokerage amount.
Representation of a Surplus Share contract.
Surfaces the value-allocator specialty structure (which is treated as a "layer definition" by the API...
A filter consisting of a list of filters, all of which have to be satisfied.
Definition AndFilter.cs:5
Matches all losses (always returns true).
Definition AnyFilter.cs:4
A filter consisting of an attribute and a list of accepted values for that attribute.
A filter where the specified attribute must have a numeric value that is greater than a specified val...
Definition GTFilter.cs:5
A filter where the specified attribute must have a numeric value that is less than a specified value.
Definition LTFilter.cs:5
A filter consisting of a list of filters, any of which have to be satisfied.
Definition OrFilter.cs:5
A filter where the specified attribute must have a numeric value that is within the specified range o...
Definition RangeFilter.cs:8
A filter consisting of an attribute and a list of accepted values for that attribute.
Representation of a single loss set with an associated event loss table.
Definition ELTLossSet.cs:10
Representation of a Loaded loss set, whose losses are derived from an existing loss set and applies a...
Representation of a Nested layer loss set, which represents any loss set whose losses are derived fro...
Representation of a Parametric loss set.
Representation of a PortfolioLossSet.
The Quantile-Based Correlated Loss Sampling (QCLS) loss set is a simulated parametric loss set which ...
Custom TreatyLossSet treaty reference type.
Representation of a TreatyLossSet.
Representation of a loss set with an associated year-event-loss table.
Representation of a loss set with an associated simulated yearly losses table.
Definition YLTLossSet.cs:11
Representation of a monetary value with a currency.
A structure indicating the min/max share constraint for a layer.
Definition DomainEntry.cs:8
Functions to be used by the Optimization platform for computing objective and constraint values.
Representation of a set of Optimization Parameters.
Functions to be used by the Optimization platform for manipulating the members of the population.
Determines the behaviour of the API when automatically retrying a request whose result is not yet rea...
Represents the Analysis of a Portfolio.
Representation of a portfolio.
Definition Portfolio.cs:12
Representation of a portfolio.
A pre-simulated representation of a Simulation (SimGrid).
IReference< T > AsReference
A reference to the posted resource.
T Unposted
The unPOSTed resource definition.
Describes an APIResource class that adds a "/data" sub-resource, since this functionality is common t...
Interface for Base class used by all resources.
Abstract representation of a layer.
Definition ILayer.cs:7
LossType
Indicates what types of losses are generated by this loss set.
Definition LossType.cs:5
@ LossNetOfAggregateTerms
Generated losses are net of aggregate terms.
@ currency
Reinstatement values represent a fixed dollar amount.
RecordType
The type of occurrence.
Definition RecordType.cs:10