Skip to content

Commit

Permalink
Added Server to Output & IdleTime as TimeSpan
Browse files Browse the repository at this point in the history
- Fixes #1 and Fixes #2
  • Loading branch information
VertigoRay committed Jul 26, 2018
1 parent 6e4d4eb commit 05e3b69
Show file tree
Hide file tree
Showing 21 changed files with 423 additions and 163 deletions.
27 changes: 15 additions & 12 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ build_script:



deploy:
release: v$(APPVEYOR_BUILD_VERSION)
description: QuserObject v$(appveyor_build_version)
provider: GitHub
auth_token:
secure: Vw4SeFATUV5sFO3gPVSe4PRu8gtUqDxSYUHRfpH+Y2n4U65IKkcFyK1dN+j3ZQq0
artifact: /.*\.zip/
draft: false
prerelease: true
on:
branch: master # release from master branch only
appveyor_repo_tag: false # deploy except on tag push only
# deploy:
# release: v$(APPVEYOR_BUILD_VERSION)
# description: QuserObject v$(appveyor_build_version)
# provider: GitHub
# auth_token:
# secure: Vw4SeFATUV5sFO3gPVSe4PRu8gtUqDxSYUHRfpH+Y2n4U65IKkcFyK1dN+j3ZQq0
# artifact: /.*\.zip/
# draft: false
# prerelease: true
# on:
# branch: master # release from master branch only
# APPVEYOR_REPO_TAG: true # deploy except on tag push only



Expand All @@ -49,3 +49,6 @@ on_success:
- ps: |
Write-Host "[AppVeyor] On Success; deploying ..." -Foregroundcolor Green
Invoke-PSDeploy -Path '.\.scripts\deploy.ps1' -Force
on:
branch: master # release from master branch only
APPVEYOR_REPO_TAG: true # deploy except on tag push only
23 changes: 16 additions & 7 deletions Examples/ConvertTo-QuserObject.Console_User_Only.psd1
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
@{
Parameters = @{
QuserOutput = @(
'USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME',
'>vertigoray console 1 Active none 7/13/2018 11:26 AM'
)
QuserOutput = @{
Server = 'localhost'
Result = @(
'USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME',
'>vertigoray console 1 Active none 7/13/2018 11:26 AM'
)
}
}
GetDateNow = '2018-07-21T11:49:09.2879117-05:00'
Output = @(
@{
Server = 'localhost'
Username = 'vertigoray'
Sessionname = 'console'
Id = 1
State = 'Active'
IdleTime = $null
LogonTime = '07/13/2018 11:26:00'
IdleTime = @{
Type = 'System.Void'
Value = $null
}
LogonTime = @{
Type = 'System.DateTime'
Value = '07/13/2018 11:26:00'
}
}
)
}
94 changes: 62 additions & 32 deletions Examples/ConvertTo-QuserObject.Four_Users_Two_Disc_Three_Idle.psd1
Original file line number Diff line number Diff line change
@@ -1,46 +1,76 @@
@{
Parameters = @{
QuserOutput = @(
'USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME',
' admin.xxxxxxxx 2 Disc 15+15:12 7/20/2017 1:19 PM',
' admin.xxxxx rdp-tcp#54 3 Active 1:39 7/21/2017 5:35 AM',
' xxxxxxxx 4 Disc 6+04:10 7/21/2017 9:25 AM',
'>vertigoray console 5 Active . 8/9/2017 4:40 PM'
)
QuserOutput = @{
Server = 'localhost'
Result = @(
'USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME',
' admin.xxxxxxxx 2 Disc 15+15:12 7/20/2017 1:19 PM',
' admin.xxxxx rdp-tcp#54 3 Active 1:39 7/21/2017 5:35 AM',
' xxxxxxxx 4 Disc 6+04:10 7/21/2017 9:25 AM',
'>vertigoray console 5 Active . 8/9/2017 4:40 PM'
)
}
}
GetDateNow = '8/9/2017 4:40 PM'
Output = @(
@{
Username = 'admin.xxxxxxxx'
Sessionname = ''
Id = 2
State = 'Disconnected'
IdleTime = '07/25/2017 16:24:48'
LogonTime = '07/20/2017 13:19:00'
Server = 'localhost'
Username = 'admin.xxxxxxxx'
Sessionname = ''
Id = 2
State = 'Disc'
IdleTime = @{
Type = 'System.TimeSpan'
Value = '15.15:12:00'
}
LogonTime = @{
Type = 'System.DateTime'
Value = '07/20/2017 13:19:00'
}
},
@{
Username = 'admin.xxxxx'
Sessionname = 'rdp-tcp#54'
Id = 3
State = 'Active'
IdleTime = '08/09/2017 16:38:21'
LogonTime = '07/21/2017 05:35:00'
Server = 'localhost'
Username = 'admin.xxxxx'
Sessionname = 'rdp-tcp#54'
Id = 3
State = 'Active'
IdleTime = @{
Type = 'System.TimeSpan'
Value = '0.01:39:00'
}
LogonTime = @{
Type = 'System.DateTime'
Value = '07/21/2017 05:35:00'
}
},
@{
Username = 'xxxxxxxx'
Sessionname = ''
Id = 4
State = 'Disconnected'
IdleTime = '08/03/2017 16:35:50'
LogonTime = '07/21/2017 09:25:00'
Server = 'localhost'
Username = 'xxxxxxxx'
Sessionname = ''
Id = 4
State = 'Disc'
IdleTime = @{
Type = 'System.TimeSpan'
Value = '6.04:10:00'
}
LogonTime = @{
Type = 'System.DateTime'
Value = '07/21/2017 09:25:00'
}
},
@{
Username = 'vertigoray'
Sessionname = 'console'
Id = 5
State = 'Active'
IdleTime = $null
LogonTime = '08/09/2017 16:40:00'
Server = 'localhost'
Username = 'vertigoray'
Sessionname = 'console'
Id = 5
State = 'Active'
IdleTime = @{
Type = 'System.Void'
Value = $null
}
LogonTime = @{
Type = 'System.DateTime'
Value = '08/09/2017 16:40:00'
}
}
)
}
Expand Down
9 changes: 9 additions & 0 deletions Examples/Get-QuserIdleTime.Day_Hour_Minute.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@{
Parameters = @{
QuserIdleTime = '3+04:05'
}
Output = @{
Type = 'System.TimeSpan'
Value = '3.04:05:00'
}
}
11 changes: 11 additions & 0 deletions Examples/Get-QuserIdleTime.Day_Hour_Minute_as_DateTime.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@{
Parameters = @{
QuserIdleTime = '3+04:05'
AsDateTime = $true
}
GetDateNow = '8/1/2018 12:01:00 PM'
Output = @{
Type = 'System.DateTime'
Value = '07/29/2018 07:56:00'
}
}
9 changes: 9 additions & 0 deletions Examples/Get-QuserIdleTime.Dot.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@{
Parameters = @{
QuserIdleTime = '.'
}
Output = @{
Type = 'System.Void'
Value = $null
}
}
11 changes: 11 additions & 0 deletions Examples/Get-QuserIdleTime.Dot_as_DateTime.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@{
Parameters = @{
QuserIdleTime = '.'
AsDateTime = $true
}
GetDateNow = '8/1/2018 12:01:00 PM'
Output = @{
Type = 'System.Void'
Value = $null
}
}
9 changes: 9 additions & 0 deletions Examples/Get-QuserIdleTime.Hour_Minute.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@{
Parameters = @{
QuserIdleTime = '4:05'
}
Output = @{
Type = 'System.TimeSpan'
Value = '0.04:05:00'
}
}
11 changes: 11 additions & 0 deletions Examples/Get-QuserIdleTime.Hour_Minute_as_DateTime.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@{
Parameters = @{
QuserIdleTime = '4:05'
AsDateTime = $true
}
GetDateNow = '8/1/2018 12:01:00 PM'
Output = @{
Type = 'System.DateTime'
Value = '08/01/2018 07:56:00'
}
}
9 changes: 9 additions & 0 deletions Examples/Get-QuserIdleTime.Minute.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@{
Parameters = @{
QuserIdleTime = '5'
}
Output = @{
Type = 'System.TimeSpan'
Value = '0.00:05:00'
}
}
11 changes: 11 additions & 0 deletions Examples/Get-QuserIdleTime.Minute_as_DateTime.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@{
Parameters = @{
QuserIdleTime = '5'
AsDateTime = $true
}
GetDateNow = '8/1/2018 12:01:00 PM'
Output = @{
Type = 'System.DateTime'
Value = '08/01/2018 11:56:00'
}
}
10 changes: 10 additions & 0 deletions Examples/Get-QuserIdleTime.None.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@{
Parameters = @{
QuserIdleTime = 'none'
}
GetDateNow = '8/1/2018 12:01:00 PM'
Output = @{
Type = 'System.Void'
Value = $null
}
}
11 changes: 11 additions & 0 deletions Examples/Get-QuserIdleTime.None_as_DateTime.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@{
Parameters = @{
QuserIdleTime = 'none'
AsDateTime = $true
}
GetDateNow = '8/1/2018 12:01:00 PM'
Output = @{
Type = 'System.Void'
Value = $null
}
}
24 changes: 12 additions & 12 deletions Examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,36 @@ The example file name follows a pattern: `%FunctionName%.%TestDescription%.psd1`

For lack of a better term, I'm going to call each item in the hashtable a *main key*.

## Parameters
## ADComputer

- Type: `[hashtable]`
- Default: `$null`
- Type: `[string]`
- Function Tests: `Get-Quser`

This is used for splatting into the function that we're testing.
If `[bool]` then we will ensure the test starts with an empty JSON (`$true`) or without a JSON at all (`$false`).

If `[string]` then we will ensure the test starts with a JSON with the contents set to value of this variable.

## GetDateNow

- Type: `[strin]`
- Function Tests: ``Get-Date``
- Function Tests: `Get-Date`, `Get-QuserIdleTime`

This specifies that `[DateTime]` that should be returned by the `Get-Date` function; for testing purposes.
Normally, calling `Get-Date` will return the current date and time.

## Output

- Type: `[array]`
- Function Tests: ``Get-Date``
- Function Tests: `Get-QuserIdleTime`

The expected output/return of the function based on the parameters used.

## ADComputer

- Type: `[string]`
- Function Tests: `Get-Quser`
## Parameters

If `[bool]` then we will ensure the test starts with an empty JSON (`$true`) or without a JSON at all (`$false`).
- Type: `[hashtable]`
- Default: `$null`

If `[string]` then we will ensure the test starts with a JSON with the contents set to value of this variable.
This is used for splatting into the function that we're testing.

## Pipeline

Expand Down
Loading

0 comments on commit 05e3b69

Please sign in to comment.