Class DeviceStubExporter
Manages the exporting of stubbed devices and factories.
Inheritance
Inherited Members
Namespace: Phoenix.Test.DeviceMockSystem
Assembly: Phoenix.Test.Infrastructure.dll
Syntax
public class DeviceStubExporter
Methods
View SourceAddFactoryCapabilityStub(String, Type, Object)
Adds a interface stub to the device factory capability interface mapping.
Declaration
public void AddFactoryCapabilityStub(string deviceName, Type interfaceType, object interfaceStub)
Parameters
Type | Name | Description |
---|---|---|
System.String | deviceName | The name of the device. |
System.Type | interfaceType | The interface type to stub. |
System.Object | interfaceStub | The stub object to return. |
CreateDeviceInstance(String, IPAddress, String, String, String, String, Nullable<Guid>)
Creates an instance of the device of the given factory name.
Declaration
public IDevice CreateDeviceInstance(string deviceName, IPAddress address = null, string name = null, string alias = null, string configurationType = null, string configuration = null, Guid? phoenixId = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | deviceName | The name of the device. |
System.Net.IPAddress | address | The IP Address of the device. |
System.String | name | The name of the device if known. |
System.String | alias | The alias of the device if known. |
System.String | configurationType | The device configuration type. |
System.String | configuration | The device configuration. |
System.Nullable<System.Guid> | phoenixId | The device id. |
Returns
Type | Description |
---|---|
IDevice | The IDevice that was created with interface mappings if set. |
GetFactoryInterface<T>(String)
Returns the interface requested for the named device.
Declaration
public T GetFactoryInterface<T>(string deviceName)
where T : class
Parameters
Type | Name | Description |
---|---|---|
System.String | deviceName | The name of the device. |
Returns
Type | Description |
---|---|
T | The interface if it is implemented or null if not implemented. |
Type Parameters
Name | Description |
---|---|
T | The interface that is being requested. |
HasFactoryInterface<T>(String)
Checks to see if this named device implements the specific interface.
Declaration
public bool HasFactoryInterface<T>(string deviceName)
Parameters
Type | Name | Description |
---|---|---|
System.String | deviceName | The name of the device. |
Returns
Type | Description |
---|---|
System.Boolean | True if it is implemented, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | The interface to check for. |
IsFactoryCapable(String, Type[])
Determines if this named device implements the specified interface types.
Declaration
public bool IsFactoryCapable(string deviceName, Type[] interfaceTypes)
Parameters
Type | Name | Description |
---|---|---|
System.String | deviceName | The name of the device. |
System.Type[] | interfaceTypes | A list of the interfaces to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if the object implements all of the interfaces, false otherwise. |
RegisterDeviceFactory(String)
Registers a device factory with the system.
Declaration
public void RegisterDeviceFactory(string deviceName)
Parameters
Type | Name | Description |
---|---|---|
System.String | deviceName | The name of the device being registered. |
RegisterDeviceWithFactory(String, Type)
Registers a device with a factory so that it is created upon request.
Declaration
public void RegisterDeviceWithFactory(string deviceName, Type deviceType)
Parameters
Type | Name | Description |
---|---|---|
System.String | deviceName | The name of the device to register the type for. |
System.Type | deviceType | The type to create as an IDevice. |
RegisterDeviceWithFactory(String, Type, Dictionary<Type, Object>)
Registers a device with a factory so that it is created upon request.
Declaration
public void RegisterDeviceWithFactory(string deviceName, Type deviceType, Dictionary<Type, object> deviceInterfaceMap)
Parameters
Type | Name | Description |
---|---|---|
System.String | deviceName | The name of the device to register the type for. |
System.Type | deviceType | The type to create as an IDevice. |
System.Collections.Generic.Dictionary<System.Type, System.Object> | deviceInterfaceMap | The capability interface mapping to use for all devices of this type. |