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
Fake()
Returns the entry which provides the fake methods from various modules
[Obsolete("Method was not intended for public use and will be removed in the next version. Use method Fake instead.")]
public IFakeMethods Fake()
Returns
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
providerObject
TProviderProvider object.
objectType
stringObject type used for registration to ObjectTypeManager.
fakeInfo
boolIf true, the info object structure is faked.
Returns
- IInfoProviderFake<TInfo, TProvider>
Type Parameters
TInfo
TProvider
Remarks
This API supports the framework infrastructure and is not intended to be used directly from your code.
Exceptions
- ArgumentNullException
Thrown when parameters
providerObject
orobjectType
are 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
id
intID of the fake object
finalizer
Action<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
settings
InfoFakeSettingsFake 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
fakeInfo
boolIf true, the info object structure is faked.
Returns
- IInfoProviderFake<TInfo, TProvider>
Returns the instance of the faked provider.
Type Parameters
TInfo
Type of info object corresponding to
TProvider
.TProvider
Type 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
TProvider
does 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
providerObject
TProviderProvider object to be used as the provider.
fakeInfo
boolIf true, the info object structure is faked.
Returns
- IInfoProviderFake<TInfo, TProvider>
Type Parameters
TInfo
Type of info object corresponding to
TProvider
.TProvider
Type of info object provider to fake metadata for.
Exceptions
- ArgumentNullException
Thrown when
providerObject
is null.
GetTestGuid(int)
Gets a predictable test GUID for the given ID
protected static Guid GetTestGuid(int id)
Parameters
id
intSource ID
Returns
- Guid
GetVirtualStorageProvider(string, string)
Returns virtual file system provider
protected AbstractStorageProvider GetVirtualStorageProvider(string storageName = "TestVirtualFileSystem", string assemblyName = "CMS.FakeFileSystemStorage")
Parameters
storageName
stringassemblyName
string
Returns
ResetAllFakes()
Resets all fakes registered within the system
public virtual void ResetAllFakes()
TestsWithDataFixtureSetup()
Fixture setup
public void TestsWithDataFixtureSetup()
TestsWithDataFixtureTearDown()
Fixture tear down
public void TestsWithDataFixtureTearDown()
TestsWithDataSetup()
Test setup
public void TestsWithDataSetup()
TestsWithDataTearDown()
Cleans test base (Restore static context)
public void TestsWithDataTearDown()