- Get VS Code
- Remove using NUnit.Framework;
- Add using XUnit;
- Replace all [Test] with [Fact]
- Replace [SetUp] with a constructor
- Replace Assert.That(actualValue, Is.EqualTo(value)); with Assert.Equal(expected, actual)
- highlight Is.EqualTo(
- Delete it
- Select to the end of the line
- Ctrl + X
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
public static class ServiceExtensions | |
{ | |
public static ServiceCollection ReplaceWithFake<T>(this ServiceCollection services) where T : class | |
{ | |
T fake = Substitute.For<T>(); | |
var descriptor = new ServiceDescriptor(typeof(T), fake.GetType(), ServiceLifetime.Scoped); | |
services.Replace(descriptor); | |
return services; |
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
public static class OptionsExtensions | |
{ | |
public static IServiceCollection ConfigureOptionsAndInstance<T>(this IServiceCollection services, IConfigurationSection section) | |
where T : class, IOptions<T>, new() | |
{ | |
services.Configure<T>(section); | |
services.AddSingleton<T>(provider => provider.GetService<IOptions<T>>().Value); | |
return services; | |
} |
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
# All commit history, e.g. "[2018-04-15 12:39:15 +0100] Chris S. A bit more readme" | |
git log --pretty=format:'[%ai] %an. %s' --abbrev-commit > commits.txt | |
# 5 commits | |
git log --pretty=format:'[%ai] %an. %s' --abbrev-commit -5 > commits.txt |
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
psql -c "create database roadkill;" -U postgres | |
psql -c "CREATE USER roadkill WITH PASSWORD 'secretpassword';" -U postgres | |
psql -c "ALTER USER roadkill WITH SUPERUSER;" -U postgres |
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
{ | |
"Smtp": { | |
"Host": "smtp.gmail.com", | |
"Port": 587, | |
"UseSSL": true, | |
"Username": "bob", | |
"Password": "password", | |
} | |
} |
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
Set-ExecutionPolicy RemoteSigned -Confirm:$false -Force | |
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) | |
# Stop prompting in Chocolately | |
choco feature enable -n allowGlobalConfirmation | |
choco install visualstudio2017community; choco install visualstudio2017-workload-netcoretools; choco install visualstudio2017-workload-netweb; choco install docker-for-windows; |
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
# Check for admin | |
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal( [Security.Principal.WindowsIdentity]::GetCurrent()) | |
if ($currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) -eq $false) | |
{ | |
Write-Error "Please run this scripts as an administrator" | |
exit 1 | |
} | |
Set-ExecutionPolicy RemoteSigned -Confirm:$false -Force | |
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) |
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
<Query Kind="Program"> | |
<Namespace>System.Globalization</Namespace> | |
</Query> | |
// Open a chat, click "..." and email to yourself (no media) | |
void Main() | |
{ | |
var messages = new List<Message>(); | |
string file = File.ReadAllText(@"/wapp.txt"); // c:\wapp.txt | |
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
# Example: ./enable-hyperv-in-hyperv.ps1 -vmName "Windows 10" | |
param ( | |
[Parameter(Mandatory = $true)]$vmName | |
) | |
Set-VMProcessor -VMName $vmName -ExposeVirtualizationExtensions $true | |
Get-VMNetworkAdapter -VMName $vmName | Set-VMNetworkAdapter -MacAddressSpoofing On | |
Write-Host "VM updated. Make sure your VM has dynamic memory enabled, and has 4gb or more" |