2using System.Collections.Generic;
13using Microsoft.VisualStudio.TestTools.UnitTesting;
16using TestClass = NUnit.Framework.TestFixtureAttribute;
17using TestMethod = NUnit.Framework.TestAttribute;
18using TestCategory = NUnit.Framework.CategoryAttribute;
26 private const string Category =
"Test API BugReports";
34 Assert.Inconclusive(
"RUN_OFFLINE = true");
38 [TestMethod, TestCategory(Category)]
44 const int api_workers = 4;
54 Simulation differentSimulation = Samples.Simulation_StaticSimulation.Posted
55 .Change(s => s.event_catalogs,
61 for (
int i = 0; i < api_workers; i++)
65 description =
"QCLS" + i,
66 simulation = differentSimulation.ToReference(),
67 correlation_coefficient = 1d,
77 loss_sets =
new List<IReference<LossSet>> { qclsLossSets[i].ToReference() }
81 analysis_profile = ap.ToReference(),
84 sink = CreateInlinedFilter(),
92 Console.Write(
"Expected error:" + ex.Message);
96 for (
int i = 0; i < api_workers; i++)
102 analysis_profile = ap.ToReference(),
105 sink = goodLayer.ToReference(),
112 [TestMethod, TestCategory(Category)]
121 Simulation differentSimulation = Samples.Simulation_StaticSimulation.Posted
122 .Change(s => s.event_catalogs,
127 description =
"Bad QCLS",
128 simulation = differentSimulation.ToReference(),
129 correlation_coefficient = 1d,
136 description =
"QS with bad QCLS",
139 loss_sets =
new List<IReference<LossSet>> { badQCLSLossSets.ToReference() }
145 analysis_profile = ap.ToReference(),
148 sink = quotaShareWithBadLossSet.ToReference(),
149 sources =
new Nested.
Sources(quotaShareWithBadLossSet.ToReference())
152 AssertApi.ExceptionThrown(() => badLayerView.Post(),
156 [TestMethod, TestCategory(Category), TestCategory(
"Randomized")]
162 for (
int i = 0; i < 10; i++)
167 Console.WriteLine($
"Test {i + 1} generated reference: {randomReference.ref_id} " +
168 $
"with type {result.GetType().NiceTypeName()}");
170 Assert.Fail($
"Test {i + 1} generated a {result?.GetType().NiceTypeName() ?? "null"}");
Create a test class that takes care of setting the server URL and cleaning up after each unit test.
void AddCommonTestInitializeAction(Action action)
Exposes sample resource objects, with built-in methods for injecting dependencies.
static readonly PollingOptions DataPollingOptions
Polling options to use when uploading a data file.
IInjectableResource< CustomSeverityDistribution > Distribution_CustomSeverityDistribution
IInjectableResource< AnalysisProfile > AnalysisProfile
An analysis profile with one of each possible type of filter.
IInjectableResource< CatXL > Layer_CatXL
IInjectableResource< EventCatalog > EventCatalog
void Test_BUG_ARE_3807_LossSetCache()
void Test_BUG_ARE_7093_Reflection_GetCollectionName_LossSource()
void Test_BUG_ARE_3821_BadQCLSLossSetLayerReference()
static Action< APIRequestException > ApiExceptionTest(HttpStatusCode expectedStatusCode)
Generate a function that will test a REST request exception in a standard way.
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...
Used to keep track of the recursive random generation process for objects and their attributes....
A collection of filthy hacks to populate some fields of APIResources objects of any type.
IReference< IAPIResource > GetRandomExistingResource(Type T, RecursionContext currentRecursion)
Tries to find an existing (POSTed) resource of the specified type without generating a new one.
A configuration of resources used to simulate a layer or portfolio.
Representation of an event catalog. The event catalog may cover multiple region/perils,...
Represents the Analysis of a Layer.
Representation of a Catastrophe Excess of Loss (CatXL) layer.
Filter is like a layer whose 'terms' are to filter events out of the loss sources....
A wrapper for a List<T> of IReference<ILayerSource> references that simplifies the construction and u...
Allows one or more source layers or layer_views to be attached as loss sources to some other layer de...
Representation of a Quota Share contract.
The Quantile-Based Correlated Loss Sampling (QCLS) loss set is a simulated parametric loss set which ...
Representation of a monetary value with a currency.
Representation of a simulation of a set of trials each representing an event occurrence sequence.
IReference< T > AsReference
A reference to the posted resource.
T Posted
The posted resource, ready to be referenced.
An interface for an object that provides access to some layer instance.
Represents the Analysis of a Layer.
Base interface for all reference entities.
@ currency
Reinstatement values represent a fixed dollar amount.