Skip to content

Commit

Permalink
Add -rt alias for -RawType on Get-SensorTarget and New-SensorParameters
Browse files Browse the repository at this point in the history
  • Loading branch information
lordmilko committed Mar 21, 2020
1 parent 1259ec9 commit b425c16
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public class GetSensorTarget : PrtgProgressCmdlet
/// <summary>
/// <para type="description">The raw type of sensor target to query for. Types that require additional information before querying (such as Oracle Tablespace) cannot be queried.</para>
/// </summary>
[Alias("rt")]
[Parameter(Mandatory = true, ParameterSetName = ParameterSet.Raw)]
public string RawType { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ public class NewSensorParametersCommand : PrtgProgressCmdlet
/// <summary>
/// <para type="description">The raw name of the sensor type to create.</para>
/// </summary>
[Alias("rt")]
[Parameter(Mandatory = true, ParameterSetName = ParameterSet.Dynamic)]
public string RawType { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ Describe "Get-SensorTarget" -Tag @("PowerShell", "UnitTest") {

$nothing | Should BeNullOrEmpty
}

It "specifies -rt" {
$item = @($device | Get-SensorTarget -rt exexml *test*)

$item.Count | Should Be 1
}
}

Context "Query Target" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,14 @@ Describe "New-SensorParameters" -Tag @("PowerShell", "UnitTest") {
$params.exefile.GetType().Name | Should Be "GenericSensorTarget"
}

It "specifies -rt" {
$params = WithResponse "MultiTypeResponse" {
$device | New-SensorParameters -rt exexml
}

$params.SensorType | Should Be "exexml"
}

#endregion
#region Set

Expand Down

0 comments on commit b425c16

Please sign in to comment.