2using System.Collections.Generic;
 
    3using System.Linq.Expressions;
 
   11using Microsoft.VisualStudio.TestTools.UnitTesting;
 
   16using TestCategory = 
NUnit.Framework.CategoryAttribute;
 
   24        private const string TypeName = 
"BaseMutableResourceTest";
 
   51        #endregion description 
   53        #region created and modified 
   62                Assert.IsNotNull(
put.created, 
"Expected a 'created' date to be assigned.");
 
   64                    "Created date changed, but it shouldn't have!");
 
   65                Assert.IsNotNull(
put.modified, 
"Expected a 'modified' date to be assigned.");
 
   67                    "Modified date is still the same as created date!");
 
 
   70        #endregion created and modified 
   88                { 
"Test1", 
"TestValue" },
 
 
  108        #region PUT Test Method Helpers 
  179                throw new ArgumentException(
"Can only be used on properties whose default type is null.");
 
 
  196        #region List Attribute Test Helpers 
  219        #endregion List Attribute Test Helpers 
  221        #region Reference Attribute Test Helpers 
  265        #endregion Reference Attribute Test Helpers 
  266        #endregion Test Method Helpers 
 
virtual void Test_Resource_PUT_Description_Blank()
 
void PUT_ListAttribute_Duplicates< TItem, TValue >(Expression< Func< T, ICollection< TItem > > > PropertyExpression, TValue valueToDuplicate, bool shouldSucceed)
 
virtual T PUT_WithChanges_Succeeds(Func< T, T > modifyTestResource)
POST a valid resource, then test doing a PUT on the resource after modifying it in some way,...
 
T PUT_WithValue< TProperty >(Expression< Func< T, TProperty > > PropertyExpression, TProperty newValue, bool shouldSucceed)
POST a valid resource, then test doing a PUT on the resource after changing a specified attribute.
 
virtual void Test_Resource_PUT_Metadata_Empty()
 
void PUT_ListAttribute_Empty< TItem >(Expression< Func< T, ICollection< TItem > > > PropertyExpression, bool? shouldSucceed=null)
 
void PUT_Reference_NullId< TRefType >(Expression< Func< T, IReference< TRefType > > > PropertyExpression)
Modifies a reference with a null Id and verifies the correct error is returned.
 
void PUT_Reference_NonExistantId< TRefType >(Expression< Func< T, IReference< TRefType > > > PropertyExpression)
Modifies a reference with a non-existent Id and verifies the correct error is returned.
 
T PUT_WithChanges_Fails(Func< T, T > modifyTestResource)
POST a valid resource, then test doing a PUT on the resource after modifying it in some way,...
 
virtual void Test_Resource_PUT_Metadata_InvalidValues()
 
void PUT_ReferenceList_NonExistantId< TRefType >(Expression< Func< T, ICollection< IReference< TRefType > > > > PropertyExpression)
Modifies a reference list with a non-existent Id and verifies the correct error is returned.
 
virtual void Test_Resource_PUT_CreatedAndModified()
 
void PUT_Attribute_Null< TProperty >(Expression< Func< T, TProperty > > PropertyExpression)
Ensure that when doing a PUT with the specified attribute null, the original value of the attribute i...
 
virtual void Test_Resource_PUT_Description()
 
virtual void Test_Resource_PUT_NoChanges()
 
virtual void Test_Resource_PUT_Description_Null()
 
virtual void Test_Resource_PUT_Metadata_Null()
 
void PUT_StringAttribute_Empty(Expression< Func< T, string > > PropertyExpression, bool? shouldSucceed=null)
Ensure that when doing a PUT with the specified attribute set to an empty string, the PUT succeeds or...
 
virtual void Test_Resource_PUT_Metadata_MixedTypes()
 
void PUT_Reference_EmptyStringId< TRefType >(Expression< Func< T, IReference< TRefType > > > PropertyExpression)
Modifies a reference with a empty string Id and verifies the correct error is returned.
 
virtual T POST_ForPutTest(T validToPost, Action< T > putTest)
Used for all PUT tests and PUT helper methods. Similar to the base helper method BaseResourceTestSuit...
 
virtual void AdditionalValidResourceTests(T posted)
Deriving classes can optionally override this function to perform additional validation on every succ...
 
virtual T TestResource
The resource used for all unit tests that require a valid prepared but unPOSTed resource.
 
Exposes sample resource objects, with built-in methods for injecting dependencies.
 
static string Valid_NonExistant_UUID
 
static void MethodIsAllowed(Action request, string methodName, bool methodAllowed=true)
Wrap a request in a tryGet with some formatting for testing purposes.
 
static Action< APIRequestException > ApiExceptionTest(HttpStatusCode expectedStatusCode)
Generate a function that will test a REST request exception in a standard way.
 
Generic Unit test implementations that will test REST methods on arbitrary resources.
 
static void ExecuteWithConsoleErrorLogging(Action action, Func< string > additionalContext=null)
Wraps the call to the action with a try/catch that doesn't handle the exception, just logs some usefu...
 
Describes a collection of resources which can be listed.
 
Specifies that the enumerable property with this attribute cannot be empty when POSTing the resource ...
 
Specifies that the property with this attribute cannot be null when POSTing the resource to the serve...
 
Utilities that reflect on a type or property expression.
 
Interface for Base class used by all stored resources.
 
Interface for Base class used by all resources.