This repository has been archived by the owner on Nov 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from jabbera/deploymentGroups
Deployment groups
- Loading branch information
Showing
29 changed files
with
1,232 additions
and
924 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"editor.insertSpaces": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+1.01 KB
(100%)
...sions/Common/DeploymentSDK/Src/Microsoft.VisualStudio.Services.DevTestLabs.Definition.dll
Binary file not shown.
Binary file modified
BIN
+520 Bytes
(100%)
...sions/Common/DeploymentSDK/Src/Microsoft.VisualStudio.Services.DevTestLabs.Deployment.dll
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
function convertTo-JsonFormat($InputObject) { | ||
if (Get-Command ConvertTo-Json -ErrorAction SilentlyContinue) | ||
{ | ||
$jsonOutput = ConvertTo-Json -InputObject $InputObject | ||
} | ||
else | ||
{ | ||
try | ||
{ | ||
add-type -assembly system.web.extensions | ||
$scriptSerializer = new-object system.web.script.serialization.javascriptSerializer | ||
$jsonOutput = $scriptSerializer.Serialize($InputObject) | ||
} | ||
catch | ||
{ | ||
Write-Verbose $_.Exception | ||
$errorMessage = "Unable to convert json string to object. Please install WMF 4.0 and try again." | ||
if($_.Exception.Message) | ||
{ | ||
$errorMessage = [string]::Format("{0} {1} {2}", $errorMessage, [Environment]::NewLine, $_.Exception.Message) | ||
} | ||
throw $errorMessage | ||
} | ||
} | ||
return $jsonOutput | ||
} | ||
|
||
function convertFrom-JsonFormat($InputObject) { | ||
if (Get-Command ConvertTo-Json -ErrorAction SilentlyContinue) | ||
{ | ||
$convertedObject = ConvertFrom-Json -InputObject $InputObject | ||
} | ||
else | ||
{ | ||
try | ||
{ | ||
add-type -assembly system.web.extensions | ||
$scriptSerializer = new-object system.web.script.serialization.javascriptSerializer | ||
$convertedObject = ,$scriptSerializer.DeserializeObject($InputObject) | ||
} | ||
catch | ||
{ | ||
Write-Verbose $_.Exception | ||
$errorMessage = "Unable to convert json string to object. Please install WMF 4.0 and try again." | ||
if($_.Exception.Message) | ||
{ | ||
$errorMessage = [string]::Format("{0} {1} {2}", $errorMessage, [Environment]::NewLine, $_.Exception.Message) | ||
} | ||
throw $errorMessage | ||
} | ||
|
||
} | ||
return $convertedObject | ||
} |
Binary file modified
BIN
-112 Bytes
(100%)
Extensions/Common/DeploymentSDK/Src/VisualStudioRemoteDeployer.exe
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
$currentScriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path | ||
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path).Replace(".Tests.", ".") | ||
$VerbosePreference = 'Continue' | ||
|
||
$UtilityScript = "$currentScriptPath\..\Src\$sut" | ||
|
||
if(-not (Test-Path -Path $UtilityScript)) | ||
{ | ||
throw [System.IO.FileNotFoundException] "Unable to find Utility.ps1 at $UtilityScript" | ||
} | ||
|
||
. "$UtilityScript" | ||
|
||
|
||
Describe "Tests for ConvertTo-JsonFormat method" { | ||
Context "Convert object to json string on PS where ConvertTo-Json cmdlet exists" { | ||
$argumentAsObject = @{Name="test";Type="task"} | ||
|
||
Mock Get-Command -Verifiable { return $true} | ||
|
||
$jsonOutput = ConvertTo-JsonFormat -InputObject $argumentAsObject | ||
|
||
It "Should convert object to json string" { | ||
$jsonOutput | Should Not be $null | ||
$jsonOutput.GetType().Name | Should Be "String" | ||
$jsonOutput.Contains("Name") | Should Be $true | ||
$jsonOutput.Contains("Type") | Should Be $true | ||
} | ||
} | ||
|
||
Context "Convert object to json string on PS where ConvertTo-Json cmdlet doesnot exists" { | ||
$argumentAsObject = @{Name="test";Type="task"} | ||
|
||
Mock Get-Command -Verifiable { return $false} | ||
|
||
$jsonOutput = ConvertTo-JsonFormat -InputObject $argumentAsObject | ||
|
||
It "Should convert object to json string" { | ||
$jsonOutput | Should Not be $null | ||
$jsonOutput.GetType().Name | Should Be "String" | ||
$jsonOutput.Contains("Name") | Should Be $true | ||
$jsonOutput.Contains("Type") | Should Be $true | ||
} | ||
} | ||
|
||
Context "Convert json string to object on PS where ConvertTo-Json cmdlet exists" { | ||
$jsonString = "{`"Name`":`"test`",`"Type`":`"task`"}" | ||
|
||
Mock Get-Command -Verifiable { return $true} | ||
|
||
$argObject = ConvertFrom-JsonFormat -InputObject $jsonString | ||
|
||
It "Should convert json string into object" { | ||
$argObject | Should Not be $null | ||
$argObject.GetType().Name | Should Be "PSCustomObject" | ||
$argObject.Name | Should Be "test" | ||
$argObject.Type | Should Be "task" | ||
} | ||
} | ||
|
||
Context "Convert json string to object on PS where ConvertTo-Json cmdlet doesnot exists" { | ||
$jsonString = "{`"Name`":`"test`",`"Type`":`"task`"}" | ||
|
||
Mock Get-Command -Verifiable { return $false} | ||
|
||
$argObject = ConvertFrom-JsonFormat -InputObject $jsonString | ||
|
||
It "Should convert json string into object" { | ||
$argObject | Should Not be $null | ||
$argObject.Name | Should Be "test" | ||
$argObject.Type | Should Be "task" | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.