7using Microsoft.VisualStudio.TestTools.UnitTesting;
52 #region Public Properties
61 public T Posted => (_posted ? _postedResource : _postedResource = Post()).
DeepCopy();
72 #endregion Public Properties
74 #region Private Fields
88 private T _postedResource;
89 #endregion Private Fields
98 "resource using a resource that was already posted elsewhere.");
109 throw new ArgumentException(
"data cannot be used on resources without a data endpoint.");
112 #endregion Constructors
114 #region Public Methods
122 if (_posted)
return _postedResource;
127 if (_posted)
return _postedResource;
136 return _postedResource;
146 _postedResource = _unPOSTedResource.Post();
161 .PollUntilReady(Samples.DataPollingOptions);
165 return _postedResource;
169 Assert.Fail(
"An error occurred while posting one of the supporting " +
170 "resources required to run this test:\n" +
e);
174 #endregion Public Methods
179 public static class InjectableResource
A class containing a resource that can be Posted with dependencies.
Type UnderlyingType
Get the runtime type of the resource that an instance will inject.
T Unposted
The unPOSTed resource definition.
static IInjectableResource< T > Create< T >(T resource, bool mocked=false)
Static method for creating wrapping a resource in a DisposableResource.Create container (where the ty...
InjectableResource(T unPOSTedResource, string data)
Create a new injectable resource with some data to upload at injection time.
IReference< T > AsInlinedReference
A reference to the unPOSTed resource (i.e. an inlined reference).
bool Mocked
If true, the resource is mocked (doesn't actually exist on a server) and so attempts to do server-sid...
T Posted
The posted resource, ready to be referenced.
InjectableResource(T unPOSTedResource)
Create a new injectable resource.
IReference< T > AsReference
A reference to the posted resource.
Exposes sample resource objects, with built-in methods for injecting dependencies.
static string Valid_NonExistant_UUID
Describes a collection of resources which can be listed.
Representation of a set of Optimization Parameters.
Interface for a class containing a resource that can be Posted with dependencies.
bool Mocked
If true, the resource is mocked (doesn't actually exist on a server) and so attempts to do server-sid...
IReference< T > AsInlinedReference
A reference to the unPOSTed resource (i.e. an inlined reference).
Type UnderlyingType
The runtime type of the resource that an instance will inject.
IReference< T > AsReference
A reference to the posted resource.
T Unposted
The unPOSTed resource definition.
T Posted
The posted resource, ready to be referenced.
Describes an APIResource class that adds a "/data" sub-resource, since this functionality is common t...
Describes an APIResource class that has a "status" property and corresponding "status_message" which ...
Interface for Base class used by all resources.
TaskStatus
The status of a data upload which may be in progress.