Class TestBotAction
An enum-based test bot action.
Inherited Members
Namespace: Microsoft.XboxStudios.BotBrain.Samples.EnumBased
Assembly: BotBrain.Samples.dll
Syntax
public class TestBotAction : EnumWrapper<TestBotActionType, TestBotAction>, IEquatable<TestBotAction>, IOperation<TestAutomatedBot>, IOperation
Remarks
Initializes a new instance of the TestBotAction class.
Constructors
View SourceTestBotAction(TestBotActionType, bool)
Initializes a new instance of the TestBotAction class.
Declaration
public TestBotAction(TestBotActionType type = TestBotActionType.Move, bool generateName = true)
Parameters
Type | Name | Description |
---|---|---|
TestBotActionType | type | The action type. |
bool | generateName | True to generate a default name based on the type. |
TestBotAction(TestBotActionType, string?)
An enum-based test bot action.
Declaration
[JsonConstructor]
public TestBotAction(TestBotActionType value, string? name)
Parameters
Type | Name | Description |
---|---|---|
TestBotActionType | value | The action type. |
string | name | The action name. |
Remarks
Initializes a new instance of the TestBotAction class.
Properties
View SourceErrorRate
Gets or sets the error rate, or how often the action fails.
Declaration
public float ErrorRate { get; set; }
Property Value
Type | Description |
---|---|
float |
ErrorsAreCancellations
Gets or sets a value indicating whether or not errors are cancellations or regular exceptions.
Declaration
public bool ErrorsAreCancellations { get; set; }
Property Value
Type | Description |
---|---|
bool |
IsRunning
Gets a value indicating whether or not the operation is running.
Declaration
public bool IsRunning { get; }
Property Value
Type | Description |
---|---|
bool |
IsSuccessful
Gets a value indicating whether or not the action was successful.
Declaration
public bool IsSuccessful { get; }
Property Value
Type | Description |
---|---|
bool |
Name
Gets or sets the action name.
Declaration
public string? Name { get; set; }
Property Value
Type | Description |
---|---|
string |
RunDelay
Gets or sets the amount of time the action runs.
Declaration
public TimeSpan RunDelay { get; set; }
Property Value
Type | Description |
---|---|
TimeSpan |
Methods
View SourceEquals(object?)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current object. |
Returns
Type | Description |
---|---|
bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
View SourceGetAwaiter(TestAutomatedBot, CancellationToken)
Gets a task used to await this operation on an item.
Declaration
public Task<bool> GetAwaiter(TestAutomatedBot item, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
TestAutomatedBot | item | The item to use. |
CancellationToken | token | A token to monitor for cancellation. |
Returns
Type | Description |
---|---|
Task<bool> | A task. |
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the current object. |
Overrides
View SourceIsRunningOn(TestAutomatedBot)
Gets a value indicating whether or not the operation is running on an item.
Declaration
public bool IsRunningOn(TestAutomatedBot item)
Parameters
Type | Name | Description |
---|---|---|
TestAutomatedBot | item | The item to use. |
Returns
Type | Description |
---|---|
bool | True if the operation is running on the item. |
Run(TestAutomatedBot)
Runs the operation on an item.
Declaration
public Task<bool> Run(TestAutomatedBot item)
Parameters
Type | Name | Description |
---|---|---|
TestAutomatedBot | item | The item. |
Returns
Type | Description |
---|---|
Task<bool> | A task that returns when the operation completes. |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |
Overrides
View SourceToTestBotAction(TestBotActionType)
Converts an action type to an action.
Declaration
public static TestBotAction ToTestBotAction(TestBotActionType value)
Parameters
Type | Name | Description |
---|---|---|
TestBotActionType | value | The action type. |
Returns
Type | Description |
---|---|
TestBotAction | The action. |
Operators
View Sourceimplicit operator TestBotAction(TestBotActionType)
Converts an action type to an action.
Declaration
public static implicit operator TestBotAction(TestBotActionType value)
Parameters
Type | Name | Description |
---|---|---|
TestBotActionType | value | The action type. |
Returns
Type | Description |
---|---|
TestBotAction |