Skip to content

Instantly share code, notes, and snippets.

View HowardvanRooijen's full-sized avatar

Howard van Rooijen HowardvanRooijen

View GitHub Profile
@HowardvanRooijen
HowardvanRooijen / Program.cs
Created October 21, 2012 18:32
Example showing how to use Microsoft.SqlServer.Types to calculate the distance between two points.
namespace Endjin.Sql.Spatial.Example
{
#region Using Directives
using System;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Types;
#endregion
Describe "Get-AllAgents" {
It "should return multiple agents" {
}
}
$ConnectionDetails = @{
ServerUrl = "teamcity.codebetter.com"
Credential = New-Object System.Management.Automation.PSCredential("teamcitysharpuser", (ConvertTo-SecureString "qwerty" -asplaintext -force))
}
Describe "Get-AllAgents" {
$parameters = @{ ConnectionDetails = $ConnectionDetails }
$result = Get-AllAgents @parameters
It "should return multiple agents" {
$result.Count.should.have_count_greater_than(1)
Function Get-AllAgents
{
param
(
[Hashtable]
$ConnectionDetails
)
$client = New-TeamCityConnection @PSBoundParameters
return $client.AllAgents()
$parameters = @{
ConnectionDetails = @{
ServerUrl = "teamcity.codebetter.com"
Credential = New-Object System.Management.Automation.PSCredential("teamcitysharpuser", (ConvertTo-SecureString "qwerty" -asplaintext -force))
}
BuildConfigId = "bt437"
}
$builds = Get-BuildConfigsByBuildConfigId @parameters
$parameters = @{
ConnectionDetails = @{
ServerUrl = "teamcity.codebetter.com"
Credential = Get-Credential
}
BuildConfigId = "bt437"
}
Function Print-TwoThings
{
Param
(
[string]
$First,
[string]
$Second
)
Function Outer-Method
{
Param
(
[string]
$First,
[string]
$Second
)
@HowardvanRooijen
HowardvanRooijen / gist:5498260
Last active October 19, 2016 07:17
Sample showing how you can use splatting to create a DSL for config data to drive a script
# This is the public script we call as an entry point into the deployment / configuration process
Function Invoke-Deployment
{
Param
(
$ApplicationPool,
$WebSite
)
Invoke-AppPoolTasks @PSBoundParameters
Function Print-TwoThings
{
Param
(
[string]
$First,
[string]
$Second
)