C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
Test_API_REST_Methods.cs
Go to the documentation of this file.
1using System;
2using System.Diagnostics;
3using System.IO;
4using System.Linq;
5
6using AnalyzeRe;
10using AnalyzeRe.Rest;
15
16#if MSTEST
17using Microsoft.VisualStudio.TestTools.UnitTesting;
18#elif NUNIT
19using NUnit.Framework;
20using TestClass = NUnit.Framework.TestFixtureAttribute;
21using TestMethod = NUnit.Framework.TestAttribute;
22using TestCategory = NUnit.Framework.CategoryAttribute;
23#endif
24
26{
27 // TODO: Update these test methods to dispose of the resources they create
28 // if resource DELETE is ever supported.
29 [TestClass]
31 {
32 private const string TestCategory = "REST Methods";
33
34 #region OPTIONS
36 [TestMethod, TestCategory(TestCategory)]
37 public void Test_API_OPTIONS()
38 {
40 Assert.Inconclusive("RUN_OFFLINE = true");
42 Assert.IsNotNull(options, "Options response body was null.");
43 Assert.IsNotNull(options.features, "Options response was missing the features list.");
44 }
45
47 [TestMethod, TestCategory(TestCategory)]
49 {
51 Assert.Inconclusive("RUN_OFFLINE = true");
53 Assert.IsTrue(options.is_optimization_enabled,
54 "Expected Optimization to be supported for integration tests.");
55 }
56 #endregion OPTIONS
57
58 #region GET
61 [TestMethod, TestCategory(TestCategory)]
70
72 [TestMethod, TestCategory(TestCategory)]
74 {
76 // Test the compile-time-typed overload (using the most-derived type)
78 Assert.AreEqual(id, retrievedTyped.id);
79
80 // Test the compile-time-typed overload (using a non-trivial base interface)
82 // The deserializer should have built an instance of the strong type
84 Assert.AreEqual(id, retrievedBase.id);
85
86 // Test the runtime-typed overload (using the most-derived type)
87 object resource = API.Get(typeof(LayerView<CatXL>), id);
89 Assert.AreEqual(id, ((LayerView<CatXL>)resource).id);
90
91 // Test the runtime-typed overload (using a non-trivial base interface)
94 Assert.AreEqual(id, ((LayerView<CatXL>)resource).id);
95 }
96
97 #region Type Resolution Tests
100 [TestMethod, TestCategory(TestCategory)]
105
108 [TestMethod, TestCategory(TestCategory)]
113
116 [TestMethod, TestCategory(TestCategory)]
121
124 [TestMethod, TestCategory(TestCategory)]
130
133 [TestMethod, TestCategory(TestCategory)]
139
142 [TestMethod, TestCategory(TestCategory)]
148
151 [TestMethod, TestCategory(TestCategory)]
157
160 [TestMethod, TestCategory(TestCategory)]
166 #endregion Type Resolution Tests
167
168 #region Test Helper Methods
172 {
174 Assert.Inconclusive("RUN_OFFLINE = true");
175 // Test GET generic method using (implied) derived compile time type.
176 AssertApi.AllPropertiesEqual(toGet, toGet.Get());
177 // Test GET generic method using (implied) base compile time type.
179 AssertApi.AllPropertiesEqual(toGet, toGetAsBase.Get());
180 // Test GET generic method using explicit base compile time type.
181 AssertApi.AllPropertiesEqual(toGet, toGet.Get_AsType<TResponse>());
182 // Test GET method using derived run-time type.
183 AssertApi.AllPropertiesEqual(toGet, (TGET)toGet.Get(typeof(TGET)));
184 // Test GET method using base run-time type.
185 AssertApi.AllPropertiesEqual(toGet, (TResponse)toGet.Get(typeof(TResponse)));
186 }
187 #endregion Test Helper Methods
188 #endregion GET
189
190 #region POST
191 #region Type Resolution Tests
194 [TestMethod, TestCategory(TestCategory)]
199
202 [TestMethod, TestCategory(TestCategory)]
207
210 [TestMethod, TestCategory(TestCategory)]
215
218 [TestMethod, TestCategory(TestCategory)]
224
227 [TestMethod, TestCategory(TestCategory)]
233
236 [TestMethod, TestCategory(TestCategory)]
242 #endregion Type Resolution Tests
243
244 #region Test Helper Methods
248 {
250 Assert.Inconclusive("RUN_OFFLINE = true");
251 // Test POST generic method using (implied) derived compile time type.
252 AssertApi.PostResponseMatches(toPost, GenericTest.POST_ValidResource(toPost));
253 // Test POST generic method using (implied) base compile time type.
255 AssertApi.PostResponseMatches(toPost, toPostAsBase.Post());
256 // Test POST generic method using explicit base compile time type.
257 AssertApi.PostResponseMatches(toPost, toPost.Post_AsType<TResponse>());
258 // Test POST method using derived run-time type.
259 AssertApi.PostResponseMatches(toPost, (T)toPost.Post(typeof(T)));
260 // Test POST method using base run-time type.
261 AssertApi.PostResponseMatches(toPost, (TResponse)toPost.Post(typeof(TResponse)));
262 }
263 #endregion Test Helper Methods
264 #endregion POST
265
266 #region PUT
267 #region Type Resolution Tests
270 [TestMethod, TestCategory(TestCategory)]
272 {
274 // Post a copy of our sample event catalog that has not yet
275 // been finalized, so that it is still mutable.
277 }
278
281 [TestMethod, TestCategory(TestCategory)]
286
289 [TestMethod, TestCategory(TestCategory)]
294 #endregion Type Resolution Tests
295
296 #region Test Helper Methods
300 {
302 Assert.Inconclusive("RUN_OFFLINE = true");
303 TPUT original = toPut.Get();
304 // Test PUT generic method using (implied) derived compile time type.
305 AssertApi.PutResponseMatches(original, toPut, original = toPut.Put());
306 // Test PUT generic method using explicit base compile time type.
307 AssertApi.PutResponseMatches(original, toPut, toPut.Put_AsType<TResponse>());
308 // Test PUT method using derived run-time type.
309 AssertApi.PutResponseMatches(original, toPut, (TPUT)toPut.Put(typeof(TPUT)));
310 // Test PUT method using base run-time type.
311 AssertApi.PutResponseMatches(original, toPut, (TResponse)toPut.Put(typeof(TResponse)));
312 // Test PUT generic method using (implied) base compile time type.
314 AssertApi.PutResponseMatches(original, toPut, toPutAsBase.Put());
315 }
316 #endregion Test Helper Methods
317 #endregion PUT
318
319 #region DELETE
320 // Currently not implemented on the server.
321 #endregion DELETE
322
323 // Test the multitude of complex uses of GetResourceList
324 #region GetResourceList
325 #region Basic Tests
328 [TestMethod, TestCategory(TestCategory)]
334
337 [TestMethod, TestCategory(TestCategory)]
339 {
341 Assert.Inconclusive("RUN_OFFLINE = true");
342 PostAggXLandCatXLLayers(out string aggId, out string catId);
345 Debug.WriteLine("Layers List contains this many items: " + result.items.Count());
346 }
347 #endregion Basic Tests
348
349 // Test that using both abstract and derived types, we can successfully
350 // make a collection request and deserialize it to the correct type.
351 #region Involving Inheritance
354 [TestMethod, TestCategory(TestCategory)]
356 {
357 PostAggXLandCatXLLayers(out string aggId, out string catId);
359 new[] { catId }, new[] { aggId });
360 }
361
364 [TestMethod, TestCategory(TestCategory)]
366 {
367 PostAggXLandCatXLLayers(out string aggId, out string catId);
369 new[] { catId, aggId });
370 }
371
374 [TestMethod, TestCategory(TestCategory)]
376 {
377 PostAggXLandCatXLLayers(out string aggId, out string catId);
379 new[] { catId, aggId });
380 }
381 #endregion Involving Inheritance
382
383 // Test that using covariant generic types (like LayerView[T]), defined in a variety of
384 // ways using abstract base classes, interfaces, and instantiable types, we can successfully make
385 // a collection request and deserialize it to the correct type.
386 #region Involving Generics
388 [TestMethod, TestCategory(TestCategory)]
390 {
391 PostAggXLandCatXLLayerViews(out string aggId, out string catId);
393 new[] { aggId, catId });
394 }
395
397 [TestMethod, TestCategory(TestCategory)]
399 {
400 PostAggXLandCatXLLayerViews(out string aggId, out string catId);
402 new[] { aggId, catId });
403 }
404
406 [TestMethod, TestCategory(TestCategory)]
408 {
409 PostAggXLandCatXLLayerViews(out string aggId, out string catId);
411 new[] { catId }, new[] { aggId });
412 }
413
415 [TestMethod, TestCategory(TestCategory)]
417 {
418 PostAggXLandCatXLLayerViews(out string aggId, out string catId);
420 new[] { catId }, new[] { aggId });
421 }
422
424 [TestMethod, TestCategory(TestCategory)]
426 {
427 PostAggXLandCatXLLayerViews(out string aggId, out string catId);
428 // Will always return an empty list because objects assignable to LayerView<ILayer>
429 // cannot be covariantly placed in a List of that type
431 null, new[] { catId, aggId });
432 }
433 #endregion Involving Generics
434
435 #region Test Helper Methods
436 // Mini set-up for most variations of the above collection tests.
437 private static void PostAggXLandCatXLLayers(out string aggId, out string catId)
438 {
441 }
442
443 // Mini set-up for most variations of the above collection tests.
444 private static void PostAggXLandCatXLLayerViews(out string aggId, out string catId)
445 {
448 }
449
457 string[] expectedIds = null, string[] excludedIds = null)
459 {
461 Assert.Inconclusive("RUN_OFFLINE = true");
462 if (expectedIds == null)
463 expectedIds = new string[] { };
464 if (excludedIds == null)
465 excludedIds = new string[] { };
466 int expectedCount = expectedIds.Length;
467
468 // Parameter to request the expected ids in bulk from the collection
470
471 // Test GetResourceList generic method using compile time type and runtime type
474 int count1 = result1.items.Count(r => expectedIds.Contains(r.id));
475 int count2 = result2.items.Count(r => expectedIds.Contains(r.id));
476 Debug.WriteLine($"Layer List contains this many items: " +
477 $"{count1} (method 1) {count2} (method 2)");
478 Assert.AreEqual(count1, count2, "GetResourceList returned different results " +
479 "using equivalent method signatures.");
480
481 Assert.IsNotNull(result1, "Expected " + expectedCount + " " +
482 typeof(T).NiceTypeName() + "s to be returned. Got null instead.");
483 // Ensure all the expectedIds exist in the results
484 Assert.AreEqual(expectedCount, count1, expectedCount - count1 + " " +
485 typeof(T).NiceTypeName() + "(s) posted not retrieved using compile-time types.");
486 // Ensure that none of the excludedIds exist in the results
487 int countEx1 = result1.items.Count(r => excludedIds.Contains(r.id));
488 Assert.AreEqual(0, countEx1, countEx1 + " " + typeof(T).NiceTypeName() +
489 "(s) posted included using compile-time types that were explicitly meant to be ignored.");
490
491 // test GetResourceList using run-time type.
492 Assert.IsNotNull(result2, "Expected " + expectedCount + " " +
493 typeof(T).NiceTypeName() + "(s) to be returned. Got null instead.");
494 // Ensure all the expectedIds exist in the results
495 Assert.AreEqual(expectedCount, count2, expectedCount - count2 + " " +
496 typeof(T).NiceTypeName() + "(s) posted not retrieved using run-time types.");
497 // Ensure that none of the excludedIds exist in the results
498 int countEx2 = result2.items.Count(r => excludedIds.Contains(r.id));
499 Assert.AreEqual(0, countEx2, countEx2 + " " + typeof(T).NiceTypeName() +
500 "(s) posted included using compile-time types that were explicitly meant to be ignored.");
501 }
502
503 // TODO: test ability to deserialize resolved references.
504 #endregion Test Helper Methods
505 #endregion GetResourceList
506
507 #region SearchResourceList
510 [TestMethod, TestCategory(TestCategory)]
512 {
514 Assert.Inconclusive("RUN_OFFLINE = true");
515 string myGuid = Guid.NewGuid().ToString();
516 StaticPortfolio portfolio = Samples.Portfolio.Unposted.DeepCopy();
517 portfolio.meta_data["key1"] = "val5";
518 portfolio.meta_data["theGuid"] = myGuid;
519 StaticPortfolio posted = portfolio.Post();
521 $"meta_data[key1]=\"val5\" AND meta_data[theGuid]=\"{myGuid}\"",
522 searchType: API.SearchType.Advanced);
523
524 Portfolio resultPortfolio = result.items.FirstOrDefault();
525 Assert.IsNotNull(resultPortfolio, "The server returned no matching portfolios.");
526
527 string postedText = String.Join(Environment.NewLine,
528 posted.meta_data.Select(kvp => $"{kvp.Key}: {kvp.Value.ToString()}"));
529 string resultPortfolioText = String.Join(Environment.NewLine,
530 resultPortfolio.meta_data.Select(kvp => $"{kvp.Key}: {kvp.Value.ToString()}"));
531
532 CollectionAssert.AreEqual(posted.meta_data, resultPortfolio.meta_data,
533 $"posted.meta_data: {postedText}{Environment.NewLine}" +
534 $"resultPortfolio.meta_data: {resultPortfolioText}");
535 }
536 #endregion SearchResourceList
537
538 #region Batch Get Items By Id
539 [TestMethod, TestCategory(TestCategory)]
541 {
543 Assert.Inconclusive("RUN_OFFLINE = true");
544 // Get two posted loss set ids.
547
548 // Retrieve these two in a batch using their ids.
549 ICollectionResponse<LossSet> result = API.BatchGet<LossSet>(new[] { ls1.id, ls2.id });
550 Assert.AreEqual(2, result.meta.total_count, "Expected exactly two results.");
551 Assert.AreEqual(1, result.items.Count(ls => ls.id == ls1.id), "A loss set was not found.");
552 Assert.AreEqual(1, result.items.Count(ls => ls.id == ls2.id), "A loss set was not found.");
553
554 // Test the same using a runtime type
556 Assert.AreEqual(2, result2.meta.total_count, "Expected exactly two results.");
557 Assert.AreEqual(1, result2.items.Count(ls => ls.id == ls1.id), "A loss set was not found.");
558 Assert.AreEqual(1, result2.items.Count(ls => ls.id == ls2.id), "A loss set was not found.");
559
560 // Use the collection method to test the same
561 result = API.LossSets.GetItems(new[] { ls1.id, ls2.id });
562 Assert.AreEqual(2, result.meta.total_count, "Expected exactly two results.");
563 Assert.AreEqual(1, result.items.Count(ls => ls.id == ls1.id), "A loss set was not found.");
564 Assert.AreEqual(1, result.items.Count(ls => ls.id == ls2.id), "A loss set was not found.");
565
566 // Use the Ids parameter directly to test the same
567 result = API.GetResourceList<LossSet>(API.Parameters.Ids(new[] { ls1.id, ls2.id }));
568 Assert.AreEqual(2, result.meta.total_count, "Expected exactly two results.");
569 Assert.AreEqual(1, result.items.Count(ls => ls.id == ls1.id), "A loss set was not found.");
570 Assert.AreEqual(1, result.items.Count(ls => ls.id == ls2.id), "A loss set was not found.");
571 }
572 #endregion Batch Get Items By Id
573
574 #region Get Stream
577 [TestMethod, TestCategory(TestCategory)]
579 {
581 Assert.Inconclusive("RUN_OFFLINE = true");
583 string originalSimulationData = posted.data.Get();
584 string fromStream = null;
585 try
586 {
587 posted.data.GetStream(stream =>
588 {
590 {
591 fromStream = reader.ReadToEnd();
592 }
593 });
594 }
595 catch (APIRequestException ex)
596 {
597 Assert.Fail("Error: " + ex +
598 "\n\nStream contained:\n" + fromStream);
599 }
601 "Data from GET did not match data from stream.");
602 }
603
605 [TestMethod, TestCategory(TestCategory)]
607 {
609 Assert.Inconclusive("RUN_OFFLINE = true");
612
614 StaticSimulation copy = null;
615 // Download the original resource's data file as a stream
616 posted.data.GetStream(stream =>
617 {
618 // Create a new resource (a copy of the original will suffice).
619 copy = posted.DeepCopy();
620 copy.description = "Copy Of " + posted.description;
621 // We must wipe the data file reference to test streaming to the new resource
622 copy.data_file = null;
623 copy = copy.Post();
624 // This function will consume the stream as it's downloaded and
625 // upload it against the new resource's data endpoint.
626 copy.data.LargeStreamUpload(stream,
627 // As part of the Large Data Upload protocol, we need to know the length
628 // of the file, which the API conveniently supplies if we make
629 // a HEAD request to the original resource's data sub-resource.
630 dataSize: posted.data.Head().ContentLength);
631 });
632 Assert.AreEqual(posted.data.Get(), copy.data.Get(),
633 "Data from copy did not match original data.");
634 }
635 #endregion Get Stream
636
639 [TestMethod, TestCategory(TestCategory)]
641 {
643 Assert.Inconclusive("RUN_OFFLINE = true");
645 for (int i = 1; i < 10000000; i = i * 7 - 1)
646 {
647 double prob = 1d / i;
648 Debug.WriteLine("Requesting metrics for return period " + i +
649 " (probability " + prob + ")");
650 TailMetrics result = layer_view.tail_metrics_blocking(prob,
653 "The return period did not survive a round trip conversion to probability.");
654 }
655 }
656
659 [TestMethod, TestCategory(TestCategory)]
661 {
663 Assert.Inconclusive("RUN_OFFLINE = true");
665 void TestThreshold(double threshold)
666 {
667 Debug.WriteLine($"Requesting metrics for threshold {threshold}");
668 ExceedanceProbability result = layer_view.exceedance_probability_blocking(
670 AssertApi.DoublesAreEqual(threshold, result.context.threshold,
671 "The threshold did not survive a round trip conversion to probability.");
672 }
673
677 TestThreshold(Double.Epsilon);
678 // Test the issue reported in ARE-5666
679 TestThreshold(Double.MaxValue);
680 // Test a hundred or so random high-precision numbers
681 Random rand = new Random();
682 Enumerable.Range(0,100).ToList().ForEach(i =>
683 TestThreshold(rand.NextDouble() * Double.MaxValue));
684 }
685 }
686}
Create a test class that takes care of setting the server URL and cleaning up after each unit test.
Exposes sample resource objects, with built-in methods for injecting dependencies.
Definition Samples.cs:14
IInjectableResource< YELTLossSet > LossSet_YELTLossSet
IInjectableResource< ILayerView< AggXL > > LayerView_AggXL
IInjectableResource< StaticSimulation > Simulation_StaticSimulation
IInjectableResource< AggXL > Layer_AggXL
IInjectableResource< AnalysisProfile > AnalysisProfile
An analysis profile with one of each possible type of filter.
IInjectableResource< StaticPortfolio > Portfolio
IInjectableResource< CatXL > Layer_CatXL
IInjectableResource< YLTLossSet > LossSet_YLTLossSet
IInjectableResource< ILayerView< CatXL > > LayerView_CatXL
IInjectableResource< EventCatalog > EventCatalog
void Test_API_GetResourceList_GenericType_Interface()
Test an interface where the collection is first implemented in a generic type.
void Test_API_GET_NoParams_Basic()
Test the simplest use of GET using a non-derived, instantiable resource type.
void Test_API_PUT_SpecifiedType_AbstractBase()
Test PUT using a derived resource type, deserializing to an abstract base identifier.
void Test_API_GetResourceList_CollectionNameOverride()
Test GetResourceList using a manually specified collection name and base type.
void Test_API_GetResourceList_NoParams_Basic()
Test the simplest use of GetResourceList using a non-derived, instantiable resource type.
void Test_API_GET_Interface()
Test GET using a generic interface type, deserializing to a generic interface identifier with a speci...
void Test_API_PUT_NoParams_Basic()
Test the simplest use of PUT using a simple instantiable resource type.
void Test_API_GetResourceList_GenericType_GenericInterface()
Test a generic interface with a covariant generic parameter.
void Test_API_POST_GenericType_Interface()
Test POST using a generic resource type, deserializing to an interface identifier.
void Test_API_GetStream_Matches_Get()
Test use of GetStream - write to string stream, and assert it matches the results of a normal GET.
void Test_API_POST_SpecifiedType_AbstractBase()
Test POST using a derived resource type, deserializing to an abstract base identifier.
void Test_API_GetResourceList_SpecifiedType_Derived()
Can we retrieve the list for a derived instantiable type, and get back only results of that type?
void Test_API_POST_GenericType_GenericInterface()
Test POST using a generic resource type, deserializing to a generic interface identifier with an inte...
void Test_API_GET_GenericType_GenericInterface()
Test GET using a generic resource type, deserializing to a generic interface identifier with an inter...
void Test_API_GET_SpecifiedType_Interface()
Test GET using a derived resource type, deserializing to an interface identifier.
void Test_API_GET_Exceedance_Probability_Thresholds()
Should be able to support a variety of thresholds without loss of precision.
void Test_API_POST_NoParams_Basic()
Test the simplest use of POST using a non-derived, instantiable resource type.
void Test_API_GetStream_ToLargeFileUpload()
Test ability to stream data from one resource to a new one being posted.
void Test_API_GetResourceList_SpecifiedType_UninstantiableInterface()
Can we retrieve the list for a non-instantiable resource type interface, and get back results that im...
void Test_API_GetResourceList_GenericType_GenericInterface_TypeSpecified()
Test a generic interface with an instantiable resource type parameter specified.
void Test_API_GET_GenericType_Interface()
Test GET using a generic resource type, deserializing to an interface identifier.
void Test_API_PUT_SpecifiedType_Interface()
Test PUT using a derived resource type, deserializing to an interface identifier.
void Test_API_GET_GenericType_GenericInterface_SpecifiedType()
Test GET using a generic resource type, deserializing to a generic interface identifier with a specif...
void Test_API_POST_GenericType_GenericInterface_SpecifiedType()
Test POST using a generic resource type, deserializing to a generic interface identifier with a speci...
void Test_API_GET_SpecifiedType_AbstractBase()
Test GET using a derived resource type, deserializing to an abstract base identifier.
void Test_API_GetResourceList_SpecifiedType_UninstantiableAbstractBase()
Can we retrieve the list for a non-instantiable abstract base type, and get back results that derive ...
void Test_API_GET_GenericInterface()
Test GET using a generic interface type, deserializing to a generic interface identifier with a speci...
void Test_API_GET_ResolveReferences()
Test the GET method with an HTTP header parameter that expands references.
void Test_API_POST_SpecifiedType_Interface()
Test POST using a derived resource type, deserializing to an interface identifier.
void Test_API_SearchResourceList()
Set some meta_data, POST it, invoke API.SearchResourceList<T> with a matching query and verify that t...
void Test_API_GET_Metrics_Probabilities()
Should be able to support every return period between 0 and 10 million without loss of precision on t...
void Test_API_GET_WithoutInstance()
Test the API.GET static method.
void Test_API_GetResourceList_GenericType_GenericType_CovariantlyInvalid()
Test a generic class with an interface type parameter specified.
void Test_API_GetResourceList_GenericType_GenericType_TypeSpecified()
Test a generic class with an instantiable resource type parameter specified.
Contains static helper methods for testing IAPIResourceView instances.
static readonly PollingOptions SimulationPolling
Settings used to ensure simulation requests are retried frequently and timeout after a reasonable amo...
static void ReferencesResolved(object obj)
Definition AssertApi.cs:558
static void DoublesAreEqual(double expected, double actual, Func< string > message, double? relative_tolerance=null)
Determines if two doubles are equivalent within the accepted tolerance.
Definition AssertApi.cs:594
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...
Generic Unit test implementations that will test REST methods on arbitrary resources.
A custom exception class that includes the RestSharp.IRestResponse that generated the exception,...
Used to deserialize server OPTIONS response.
Describes a collection of resources which can be listed.
Dictionary< string, object > meta_data
Any user-defined metadata for this layer.
Parameters that can be added to your REST requests to access additional API features.
static RequestParameters Ids(IEnumerable< string > ids)
Can be added to your collection GET requests to return only the set of resources whose id matches one...
static RequestParameters ExpandReferences()
Can be added to your GET requests to recursively resolve resource references in the response....
API methods / requests made available to the user.
static OptionsResponse Options(IEnumerable< Parameter > requestParameters=null, int? timeout=null)
Perform an OPTIONS request on the API, which returns a list of features supported for the current aut...
static readonly ResourceCollection< LossSet > LossSets
The collection of LossSets on the server.
static ICollectionResponse< IAPIResource > GetResourceList(Type resourceType, IEnumerable< Parameter > requestParameters=null, string collectionNameOverride=null, int? timeout=null)
Get a collection of resources from the server.
static ICollectionResponse< IAPIResource > SearchResourceList(Type resourceType, string searchTerms, IEnumerable< Parameter > requestParameters=null, string collectionNameOverride=null, int? timeout=null, SearchType searchType=SearchType.Basic)
Get a collection of resources from the server that match the specified search criteria.
static IAPIResource Get(Type resourceType, string id, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
Get the selected resource by ID. The appropriate collection is automatically determined by the suppli...
SearchType
The search type determines the interpretation of the query string.
static ICollectionResponse< IAPIResource > BatchGet(Type resourceType, IEnumerable< string > ids, IEnumerable< Parameter > requestParameters=null, string collectionNameOverride=null, int? timeout=null)
Get a collection of resources from the server that match the set of resource ids specified.
A configuration of resources used to simulate a layer or portfolio.
Base class for all LossSet sub-types. A LossSet is a resource that generates sample (trial) losses wh...
Definition LossSet.cs:13
Optional parameters which can be specified for exceedance probability requests.
static new ExceedanceProbabilityOptions Default
The default exceedance probability request options used when none are specified.
The structure returned when requesting Exceedance Probability for a view.
Context context
The context of a tail metrics request, indicating what parameters were used in the simulation that pr...
Optional parameters which can be specified for all metrics requests.
static new MetricsOptions Default
The default metrics request options used when none are specified.
double probability
The probability determining where the tail distribution begins. Note that this is equal to the Window...
The structure returned when requesting Tail Metrics for a view.
Context context
The context of a tail metrics request, indicating what parameters were used in the simulation that pr...
Representation of a portfolio.
Definition Portfolio.cs:12
Helper class which makes it easier to build a set of request parameters.
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.
T Posted
The posted resource, ready to be referenced.
Interface for Base class used by all resources.
Represents the Analysis of a Layer.
string ref_id
The id of the object being referred to.
Definition IReference.cs:17