Class AutomatedTestsWithData
Base class for automated tests with data support
public abstract class AutomatedTestsWithData : AutomatedTests
- Inheritance
-
objectAutomatedTestsWithData
- Derived
- Inherited Members
- Extension Methods
Constructors
AutomatedTestsWithData()
protected AutomatedTestsWithData()
Methods
FakeDynamicObjectType<TInfo, TProvider>(TProvider, string, bool)
Fakes the dynamic data provider.
protected IInfoProviderFake<TInfo, TProvider> FakeDynamicObjectType<TInfo, TProvider>(TProvider providerObject, string objectType, bool fakeInfo = true) where TInfo : AbstractInfoBase<TInfo>, IInfo, new() where TProvider : class, ITestableProvider, new()
Parameters
providerObjectTProviderProvider object.
objectTypestringObject type used for registration to ObjectTypeManager.
fakeInfoboolIf true, the info object structure is faked.
Returns
- IInfoProviderFake<TInfo, TProvider>
Type Parameters
TInfoTProvider
Remarks
This API supports the framework infrastructure and is not intended to be used directly from your code.
Exceptions
- ArgumentNullException
Thrown when parameters
providerObjectorobjectTypeare null.
FakeObject<TInfo>(int, Action<TInfo>)
Fakes the data for the given info
public TInfo FakeObject<TInfo>(int id, Action<TInfo> finalizer = null) where TInfo : BaseInfo, IInfo, new()
Parameters
idintID of the fake object
finalizerAction<TInfo>Optional action allowing to seed additional fields.
Returns
- TInfo
Type Parameters
TInfo
Remarks
When finalizer is called, provided TInfo object has following properties already set:
ObjectID,
ObjectCodeName,
ObjectGUID,
ObjectDisplayName.
Fake<TInfo>(InfoFakeSettings)
Fakes the data for the given info
protected IInfoFake<TInfo> Fake<TInfo>(InfoFakeSettings settings = null) where TInfo : BaseInfo, IInfo, new()
Parameters
settingsInfoFakeSettingsFake settings
Returns
- IInfoFake<TInfo>
Type Parameters
TInfo
Fake<TInfo, TProvider>(bool)
Fakes the metadata for TProvider and optionally for TInfo so a test
can execute without retrieving the metadata from the database.
An instance of TProvider is created and set as the provider instance. To fake metadata for a provider type
not containing a public parameterless constructor, use the Fake<TInfo, TProvider>(TProvider, bool) override
while specifying an explicit provider instance.
protected IInfoProviderFake<TInfo, TProvider> Fake<TInfo, TProvider>(bool fakeInfo = true) where TInfo : AbstractInfoBase<TInfo>, IInfo, new() where TProvider : class
Parameters
fakeInfoboolIf true, the info object structure is faked.
Returns
- IInfoProviderFake<TInfo, TProvider>
Returns the instance of the faked provider.
Type Parameters
TInfoType of info object corresponding to
TProvider.TProviderType of info object provider to fake metadata for.
Remarks
To fake metadata of a TInfo provider whose provider class is not generated, use IInfoProvider<TInfo> as the TProvider type.
Exceptions
- ArgumentException
Thrown when
TProviderdoes not implement CMS.DataEngine.ITestableProvider.
Fake<TInfo, TProvider>(TProvider, bool)
Fakes the metadata for TProvider and optionally for TInfo so a test
can execute without retrieving the metadata from the database.
The providerObject is set as the provider instance.
protected IInfoProviderFake<TInfo, TProvider> Fake<TInfo, TProvider>(TProvider providerObject, bool fakeInfo = true) where TInfo : AbstractInfoBase<TInfo>, IInfo, new() where TProvider : class, ITestableProvider
Parameters
providerObjectTProviderProvider object to be used as the provider.
fakeInfoboolIf true, the info object structure is faked.
Returns
- IInfoProviderFake<TInfo, TProvider>
Type Parameters
TInfoType of info object corresponding to
TProvider.TProviderType of info object provider to fake metadata for.
Exceptions
- ArgumentNullException
Thrown when
providerObjectis null.
GetTestGuid(int)
Gets a predictable test GUID for the given ID
protected static Guid GetTestGuid(int id)
Parameters
idintSource ID
Returns
- Guid
GetVirtualStorageProvider(string, string)
Returns virtual file system provider
protected AbstractStorageProvider GetVirtualStorageProvider(string storageName = "TestVirtualFileSystem", string assemblyName = "CMS.FakeFileSystemStorage")
Parameters
storageNamestringassemblyNamestring
Returns
ResetAllFakes()
Resets all fakes registered within the system
public virtual void ResetAllFakes()
TestsWithDataTearDown()
Cleans test base (Restore static context)
public void TestsWithDataTearDown()