C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
Test_API_Configuration.cs
Go to the documentation of this file.
1using System;
2using AnalyzeRe;
5
6#if MSTEST
7using Microsoft.VisualStudio.TestTools.UnitTesting;
8#elif NUNIT
9using NUnit.Framework;
10using TestClass = NUnit.Framework.TestFixtureAttribute;
11using TestMethod = NUnit.Framework.TestAttribute;
12using TestCategory = NUnit.Framework.CategoryAttribute;
13#endif
14
16{
17 [TestClass]
19 {
20 private const string TestCategory = "API Configuration";
21
22 [TestMethod, TestCategory(TestCategory)]
23 public virtual void Test_API_Server_Active()
24 {
26 Assert.Inconclusive("RUN_OFFLINE = true");
28 "No active server found at " + BaseServerTestSuite.API_URL);
29 }
30
31 [TestMethod, TestCategory(TestCategory)]
32 public virtual void Test_API_Timeout_0()
33 {
34 AssertApi.ExceptionThrown<ArgumentException>(() => API.DefaultRequestTimeout = 0);
35 }
36 }
37}
Create a test class that takes care of setting the server URL and cleaning up after each unit test.
static string API_URL
Location of the REST API being tested against. This can be set using the API_URL environment variable...
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...
API methods / requests made available to the user.
static int DefaultRequestTimeout
The default timeout used for all simple server requests, in milliseconds.
static bool IsAReServerActive(string checkServerURL, int? timeout=null)
Determines if the provided URL is a valid running Analyze Re server.