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
| public class RouteFixture | |
| { | |
| private readonly HttpContextBase _httpContextMock; | |
| private readonly RouteCollection _routes; | |
| public RouteFixture() | |
| { | |
| _routes = new RouteCollection(); | |
| RouteConfig.RegisterRoutes(_routes); |
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
| Properties { | |
| $build_dir = Split-Path $psake.build_script_file | |
| $build_artifacts_dir = "$build_dir\..\BuildArtifacts\" | |
| $code_dir = "$build_dir\..\" | |
| $soln = "$build_dir\..\AgentHoney.Azure.sln" | |
| $nuget_package_dir = "$build_dir\..\..\Packages" | |
| $database_server = ".\SqlExpress" | |
| $database_instance = "AgentHoney_AutoTestDb" | |
| $ef_tools_ouput = "$build_artifacts_dir\Tools\EF\" | |
| } |
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
| $ErrorActionPreference = "Stop" | |
| Set-ExecutionPolicy RemoteSigned | |
| ECHO "Installing PsGet and PS plugins" | |
| iex ((new-object Net.WebClient).DownloadString("http://psget.net/GetPsGet.ps1")) | |
| Install-Module pscx | |
| Install-Module psake | |
| ECHO "FINISHED - Installing PsGet and PS plugins - FINISHED" |
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 dt = DateTime.UtcNow; | |
| var utcOffset = new DateTimeOffset(dt, TimeSpan.Zero); | |
| //TimeZoneInfo.GetSystemTimeZones() - provides timezone identifiers | |
| (from t in new []{ | |
| new {Name = "UK", TimeZoneId= "GMT Standard Time"}, | |
| new {Name = "WA", TimeZoneId= "W. Australia Standard Time"}, | |
| new {Name = "NT", TimeZoneId= "AUS Central Standard Time"}, | |
| new {Name = "NSW", TimeZoneId= "E. Australia Standard Time"}, | |
| new {Name = "VIC", TimeZoneId= "E. Australia Standard Time"}, | |
| new {Name = "ACT", TimeZoneId= "E. Australia Standard Time"}, |
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
| void Main() | |
| { | |
| ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; | |
| var results = from project in TeamCityWebRequest.GetTeamCityProjects() | |
| from build in TeamCityWebRequest.GetTeamCityBuilds(project) | |
| select new {project, build}; | |
| results.Dump(); | |
| } | |
| public class TeamCityWebRequest |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Data.Entity; | |
| namespace EFConsoleApplication.Basic | |
| { | |
| public class Parent | |
| { | |
| public Parent() | |
| { |
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
| public class Parent | |
| { | |
| public Parent() | |
| { | |
| Children = new HashSet<Child>(); | |
| } | |
| public int ParentId { get; set; } | |
| public string Name { get; set; } | |
| public ICollection<Child> Children { get; set; } | |
| } |
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 Select-UniqueChildrenWithStringPattern { | |
| param($path, $pattern) | |
| Get-ChildItem $path -Recurse | | |
| Select-String -Pattern $pattern | | |
| Select-Object Path | | |
| Get-Unique | |
| } | |
| function String-ReplaceRecursive { | |
| param($path, $pattern, $replaceValue) |
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 Get-ChildFolderTotalSize | |
| { | |
| param($parentDir) | |
| $children = (Get-ChildItem $parentDir | Where-Object {$_.PSIsContainer -eq $True} | Sort-Object) | |
| $results = @(); | |
| foreach ($i in $children) | |
| { | |
| $childSum = (Get-ChildItem $i.FullName -recurse | Measure-Object -property length -sum) | |
| $results += New-Object Object | |
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
| #config swapper | |
| #load the default values in to a hash | |
| #get the values from the env and override in the hash | |
| #foreach key in the hash replace the {[key]} with the value i.e. (Get-Content $_) -replace "$tokenedKey","$value" | Set-Content -path $_.$env | |
| function Create-ConfigFromTemplate{ | |
| param ([string]$envPropFile, #".\$env.properties" | |
| [string]$outputFolder,#".\$env\ | |
| [string]$templateFile #".\App.template.config" | |
| ) | |