![]() |
C# Client Library
A C# Client Library for the AnalyzeRe REST API
|
Static Public Member Functions | |
| static void | AllPropertiesEqual< T > (T objExpected, T objActual) |
| Check that all properties of the two objects match. A deep object value equivalency test. | |
| static bool | AlmostEquals (double d1, double d2, double tolerance=DEFAULT_DOUBLE_EQUIVALENCE_TOLERANCE) |
| Determines if two doubles are equivalent within the specified tolerance. | |
| static Action< APIRequestException > | ApiExceptionTest (HttpStatusCode expectedStatusCode) |
| Generate a function that will test a REST request exception in a standard way. | |
| static void | DatesAreEqual (DateTime? dt1, DateTime? dt2, string propertyName="DateTime") |
| Asserts that two dates are equal within the supported precision. Analyze Re only supports a precision of up to 3 decimal places, the rest is truncated. | |
| static void | DoublesAreEqual (double expected, double actual, Func< string > message, double? relative_tolerance=null) |
| Determines if two doubles are equivalent within the accepted tolerance. | |
| static void | DoublesAreEqual (double expected, double actual, string message=null, double? relative_tolerance=null) |
| Determines if two doubles are equivalent within the accepted tolerance. | |
| static void | ExceptionThrown< T > (Action action, Action< T > exceptionTest=null) |
| Asserts that an exception is thrown while invoking an action, and optionally performs an additional test as to whether the exception thrown is correct. | |
| static bool | FileContentsAreEqual (string expected, string actual, StringComparison comparisonType=StringComparison.InvariantCulture) |
| Determines whether the two strings are equal, ignoring differences in line ending styles and trailing white space. | |
| static void | IsValidUUID (string toCheck) |
| Assert that the string is a valid UUID. | |
| static void | LogExceptionDetails (Exception ex) |
| Creates a useful log of the exception details, and in request/response resulting in the error if any is available. | |
| static void | MethodIsAllowed (Action request, string methodName, bool methodAllowed=true) |
| Wrap a request in a tryGet with some formatting for testing purposes. | |
| static void | PostResponseMatches< T > (T objPosted, T objReturned) |
| Check that all properties of POST response matches expectations of how the API responds to requests. A deep object value equivalency test. | |
| static void | PutResponseMatches< T > (T original, T objPut, T objReturned) |
| Check that all properties of a PUT response matches expectations of how the API responds to requests. A deep object value equivalency test. | |
| static void | ReferencesResolved (object obj) |
| static bool | TryFindException< T > (Exception ex, out T foundException) |
| Convert the current exception to the specified Exception type T , or check if any InnerExceptions match that type. | |
Static Public Attributes | |
| const double | DEFAULT_DOUBLE_EQUIVALENCE_TOLERANCE = 1E-14 |
Definition at line 25 of file AssertApi.cs.
|
inlinestatic |
Check that all properties of the two objects match. A deep object value equivalency test.
| objExpected | The expected object. |
| objActual | The actual object. |
| T | : | IAPIType |
Definition at line 129 of file AssertApi.cs.
|
inlinestatic |
Determines if two doubles are equivalent within the specified tolerance.
| d1 | The expected value of 'actual' |
| d2 | The value to compare to 'expected' |
| tolerance | (Default DEFAULT_DOUBLE_EQUIVALENCE_TOLERANCE) The relative (ratio) tolerance for the equivalency test. |
Definition at line 622 of file AssertApi.cs.
|
inlinestatic |
Generate a function that will test a REST request exception in a standard way.
| expectedStatusCode | The expected status code of the REST response error. |
Definition at line 539 of file AssertApi.cs.
|
inlinestatic |
Asserts that two dates are equal within the supported precision. Analyze Re only supports a precision of up to 3 decimal places, the rest is truncated.
| dt1 | The first DateTime. |
| dt2 | The second DateTime. |
| propertyName | The property name to use in the error message if the DateTimes are not equal. |
Definition at line 635 of file AssertApi.cs.
|
inlinestatic |
Determines if two doubles are equivalent within the accepted tolerance.
| expected | The expected value of 'actual' |
| actual | The value to compare to 'expected' |
| message | Gets the error message to raise if and only if the assertion fails. |
| relative_tolerance | The double comparison relative (ratio) tolerance. |
Definition at line 594 of file AssertApi.cs.
|
inlinestatic |
Determines if two doubles are equivalent within the accepted tolerance.
| expected | The expected value of 'actual' |
| actual | The value to compare to 'expected' |
| message | (Optional) The message to output if the assertion fails. |
| relative_tolerance | The double comparison relative (ratio) tolerance. |
Definition at line 608 of file AssertApi.cs.
|
inlinestatic |
Asserts that an exception is thrown while invoking an action, and optionally performs an additional test as to whether the exception thrown is correct.
| T | The expected exception type |
| action | The action to perform. |
| exceptionTest | A optional action (presumably an assertion) to execute on the returned exception, presuming it was of the expected type. |
| T | : | Exception |
Definition at line 68 of file AssertApi.cs.
|
inlinestatic |
Determines whether the two strings are equal, ignoring differences in line ending styles and trailing white space.
| expected | The original string. |
| actual | The string that should match. |
| comparisonType | The StringComparison to use. |
Definition at line 528 of file AssertApi.cs.
Assert that the string is a valid UUID.
| toCheck | The string to check. |
Definition at line 644 of file AssertApi.cs.
Creates a useful log of the exception details, and in request/response resulting in the error if any is available.
This generates a significant amount of console output, and should only be invoked for unwanted exceptions, not for expected errors scenarios.
Definition at line 51 of file AssertApi.cs.
|
inlinestatic |
Wrap a request in a tryGet with some formatting for testing purposes.
| request | Asserts that a request either is or is not permitted by the server. |
| methodName | The name of the method (only used creating meaningful error messages) |
| methodAllowed | True if the method should be allowed (2XX response), or false if it should return a 404 method not allowed. |
Definition at line 98 of file AssertApi.cs.
|
inlinestatic |
Check that all properties of POST response matches expectations of how the API responds to requests. A deep object value equivalency test.
| objPosted | The object included in the POST body, which is expected to match the resulting response object. |
| objReturned | The POST response that was returned by the server. |
| T | : | IAPIResource |
Definition at line 150 of file AssertApi.cs.
|
inlinestatic |
Check that all properties of a PUT response matches expectations of how the API responds to requests. A deep object value equivalency test.
| original | The original resource retrieved from the server before performing a PUT. |
| objPut | The object used to generate the PUT request body. |
| objReturned | The PUT response that was returned by the server. |
| T | : | IAPIResource |
Definition at line 172 of file AssertApi.cs.
Definition at line 558 of file AssertApi.cs.
|
inlinestatic |
Convert the current exception to the specified Exception type T , or check if any InnerExceptions match that type.
| T | The Exception type to locate. |
| ex | The exception to traverse. |
| foundException | The exception found with the specified type. |
| T | : | Exception |
Definition at line 35 of file AssertApi.cs.
|
static |
Definition at line 27 of file AssertApi.cs.