This file contains hidden or 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
do { | |
write-host Installing powershell 4.0... -ForegroundColor Gray | |
start-sleep -s 10 | |
} while ((get-process | where { $_.ProcessName -eq "wusa" }) -ne $Null) |
This file contains hidden or 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
var controller = new CustomerController(_customerService.Object); | |
var newModel = new CreateModel(); | |
var validationContext = new ValidationContext(newModel, null, null); | |
var validationResults = new List<ValidationResult>(); | |
Validator.TryValidateObject(newModel, validationContext, validationResults, true); | |
foreach (var validationResult in validationResults) | |
{ | |
controller.ModelState.AddModelError(validationResult.MemberNames.FirstOrDefault() ?? string.Empty, validationResult.ErrorMessage); |
This file contains hidden or 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
# Register a new Repository | |
Register-PSRepository | |
-Name PSRepository | |
-PackageManagementProvider NuGet | |
-InstallationPolicy Trusted | |
-Credential Get-Credential | |
-SourceLocation https://<project-name>.pkgs.visualstudio.com/_packaging/<repo-name>/nuget/v3/index.json | |
-PublishLocation https://<project-name>.pkgs.visualstudio.com/_packaging/<repo-name>/nuget/v3/index.json | |
This file contains hidden or 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
function Say-Hello() { | |
write-host Hello! -ForegroundColour green | |
} | |
function Say-Goodbye() { | |
write-host Goodbye! -ForegroundColour red | |
} |
This file contains hidden or 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
New-ModuleManifest -Path "C:\Program Files\WindowsPowerShell\Modules\Greetings\Greetings.psd1" | |
-RootModule 'Greetings.psm1' | |
-Author 'John Moss' |
This file contains hidden or 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
# Add TFS Package Management Source for Nuget | |
nuget.exe sources add -name Powershell -source http://url/to/package/repo/index.json -username VSTS -password "pat-from-tfs" -storePasswordInClearText | |
# Register the PowershellGet source | |
Register-PSRepository -Name Powershell -SourceLocation http://url/to/package/repo/index.json -PackageManagementProvider NuGet -PublishLocation http://url/to/package/repo/index.json -InstallationPolicy Trusted -Credential Get-Credential | |
# Finally we can push the loaded module to our TFS Repository | |
Publish-Module -Name Greetings -Repository Powershell -NuGetApiKey "pat-from-tfs" -Credential Get-Credential |
This file contains hidden or 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
// CsvHelper.CsvReader:- https://joshclose.github.io/CsvHelper/ | |
var result = new List<OrderRow>(); | |
using (TextReader fileReader = File.OpenText(_fileName)) | |
{ | |
var csvReader = new CsvReader(fileReader); | |
csvReader.Configuration.HasHeaderRecord = false; | |
while (csvReader.Read()) | |
{ |
This file contains hidden or 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
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | |
Install-Module vim-x64 -y | |
Install-Module -Name PowerShellForGitHub | |
Test-path $profile # if false then we create the profile file |
This file contains hidden or 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
$subscription_id_test = "<guid>" | |
$ScriptPath = Split-Path $MyInvocation.InvocationName | |
$templateFile = "$ScriptPath\WebApi\WebSite.json" # Sample Azure Template | |
$name = "TestWebApi" | |
$hostPlan = "F1" # Defined in the parameters in template | |
write-host Importing azure module -ForegroundColor gray | |
Import-Module -Name AzureRM |
This file contains hidden or 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
Feature: UserAdmin | |
In order to use the site | |
As an employee | |
I want to be able to register and login to the site | |
Scenario: A valid user can login to the site | |
Given I am a valid user of the site | |
And I have navigated to the login page | |
And I have entered a username of "johndoe" and a password of "Password1!" | |
When I click the create button |