8using Microsoft.VisualStudio.TestTools.UnitTesting;
13using TestCategory =
NUnit.Framework.CategoryAttribute;
28 private const string TypeName =
"BaseAbstractStoredResourceTestSuite";
30 [
TestMethod, TestCategory(TypeName), TestCategory(
"Randomized")]
34 Assert.Inconclusive(
"RANDOMIZED_TESTS_ENABLED = false");
40 timeout: EnvironmentSettings.COLLECTION_REQUEST_TIMEOUT * 10);
53 private const string TypeName =
"BaseAbstractResourceTest";
71 [
TestMethod, TestCategory(TypeName), TestCategory(
"Randomized")]
75 Assert.Inconclusive(
"RANDOMIZED_TESTS_ENABLED = false");
80 [
TestMethod, TestCategory(TypeName), TestCategory(
"Randomized")]
84 Assert.Inconclusive(
"RANDOMIZED_TESTS_ENABLED = false");
95 Assert.AreEqual(0,
returned,
"Only one item existed in the collection, " +
96 "so getting offset of 1 should have yielded an empty list.");
98 Assert.IsTrue(
returned > 0,
"More than one item existed in the collection, " +
99 "so getting offset of 1 should have yielded a non-empty list.");
101 Assert.AreEqual(2,
returned,
"The pagedList limit was set to 2, " +
102 "so there should be exactly 2 results.");
112 Assert.Inconclusive(
"RUN_OFFLINE = true");
124 Assert.Inconclusive(
"RUN_OFFLINE = true");
148 [
TestMethod, TestCategory(TypeName), TestCategory(
"Randomized")]
152 Assert.Inconclusive(
"RANDOMIZED_TESTS_ENABLED = false");
164 Assert.Inconclusive(
"RUN_OFFLINE = true");
178 Assert.Inconclusive(
"RUN_OFFLINE = true");
Tests for a collection (or base resource type) which do not require an instance of that resource to b...
virtual void Test_Resource_PUT_NullID()
virtual void Test_Resource_PUT_BadlyFormed()
Verify that doing a PUT for a resource with a malformed id returns a NotFound error.
virtual void Test_Resource_GET_Collection()
virtual void Test_Resource_GET_NullID()
virtual void Test_Resource_GET_Collection_AllTypes()
virtual void Test_Resource_POST_AllTypes()
virtual void Test_Resource_PUT_NonExistant()
Verify that doing a PUT for a resource that doesn't exist returns a NotFound error.
virtual void Test_Resource_GET_BadlyFormed()
Verify that doing a get for a resource with a malformed id returns a NotFound error.
virtual void Test_Resource_PUT_EmptyID()
virtual void Test_Resource_GET_NonExistant()
Verify that doing a get for a resource that doesn't exist returns a NotFound error.
virtual bool PUT_Allowed
Whether resources of this type support the PUT method. Deriving class should override the below if th...
virtual void Test_Resource_GET_Collection_AllTypes_Pagination()
virtual void Test_Resource_GET_EmptyID()
IResourceCollection< T > collection_source
The ICollection object that can be used to retrieve resources of this type (as an alternative to the ...
Tests for a stored resource collection which do not require an instance of that resource to be define...
virtual void Test_Resource_GET_Collection_AllTypes_ResolveReferences()
static Reflection Reflection
Shared instance of a class for generating random resources.
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.
static string Valid_NonExistant_UUID
static void ReferencesResolved(object obj)
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...
static bool RANDOMIZED_TESTS_ENABLED
If false, tests that involve random generation of resources (which can be unstable) will be skipped.
Generic Unit test implementations that will test REST methods on arbitrary resources.
A collection of filthy hacks to populate some fields of APIResources objects of any type.
Describes a collection of resources which can be listed.
Parameters that can be added to your REST requests to access additional API features.
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.
Interface for Base class used by all stored resources.
Interface for Base class used by all resources.