Skip to content

Instantly share code, notes, and snippets.

Getting to the conference

Prague has amazing public transport system, it is clean, convenient, and cheap way to get from point A to B, including from airport to city center. Prague public transport includes buses, trams, subway (metro), and some trains, boats, and also a funicular.

Tickets for Prague public transport can be bought in yellow machines, directly in trams and some busses, and more conveniently via PID Litacka app available for both iPhone and Android: https://app.pidlitacka.cz/

In the application you want to select Tickets > Buy a ticket > Prague

Tickets start at 30 CZK per single 30 minute ride for adult, but we recommend 330 CZK (14 EUR) 72 hour ticket, or 120 CZK (5 EUR) 24 hour ticket, if you plan to explore Prague a little bit.

@nohwnd
nohwnd / UnitTest1.cs
Last active April 8, 2022 05:57
MSTest parallel output demo
using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[assembly: Parallelize(Workers = 0, Scope = ExecutionScope.MethodLevel)]
namespace mstest;
[TestClass]
public class UnitTest1
{
@nohwnd
nohwnd / Internal.cs
Created August 6, 2021 10:09
Find internal classes
using System;
using System.Linq;
using System.Reflection;
namespace ConsoleApp28
{
class Program
{
static void Main(string[] args)
{
@nohwnd
nohwnd / script-block-local.ps1
Created July 2, 2021 07:49
scriptblock local storage
# create a scriptblock that has scriptblock local data attached (data common to all invocation of the scriptblock)
# but is still bound to the same session state, this is differnt from closure, because closures are their own modules
$sb = {
$location
$self = $MyInvocation.MyCommand.ScriptBlock
($self.___data.Count++)
}
$sb.PSObject.Properties.Add([System.Management.Automation.PSNoteProperty]::new("___data", @{ Count = 1}))
@nohwnd
nohwnd / get-testparents.ps1
Last active June 21, 2021 10:38
Get-TestParents
function Get-TestParents {
<#
.SYNOPSIS
Returns any parents not already known, top-down first, so that a hierarchy can be created in a streaming manner
#>
param (
#Test to fetch parents of. For maximum efficiency this should be done one test at a time and then stack processed
[Parameter(Mandatory,ValueFromPipeline)][Pester.Test[]]$Test,
[HashSet[Pester.Block]]$KnownParents = [HashSet[Pester.Block]]::new()
@nohwnd
nohwnd / run.ps1
Last active May 16, 2021 14:01
Compare CC in Pester
$c = New-PesterConfiguration
# your Path
$c.Run.Path = "."
$c.Run.PassThru = $true
# detailed prints the CC report, but that is very verbose
# use only for tiny codebases
# $c.Output.Verbosity = "Detailed"
@nohwnd
nohwnd / .gitignore
Last active October 29, 2021 12:39
Use Pester code coverage with CoverageGutters in VSCode
coverage.xml
# ModuleName defines in which session state the mock will be effective, not in which module the function was defined.
# This is important when mocking functions exported from a module either when calling them from a script, or when calling
# them from a different module. In that case you want to define the mock in the place where the function is called from,
# not in the module where the function is defined.
# The only time you want to define the mock in the module where the function is defined is when you are testing an internal
# functions of the module (not shown here).
Invoke-Pester -Container (
New-PesterContainer -ScriptBlock {
BeforeAll {
Get-Module m, n, o | Remove-Module
@nohwnd
nohwnd / discover-setup-run.ps1
Last active April 16, 2021 10:36
Bunching expensive setup in Pester
## Run only discovery, select tests that need really expensive setup that takes
# long time to be present in the target system. E.g. 30 minutes per file to be updated
# in a remote resource. And run just the discovery, setup all tests that would run across
# all files (we use only one here but it does not matter).
# And then run the tests, communicating back which resources were created so we get failures
# in their respective tests.
Import-Module Pester -RequiredVersion 5.2.0 -Force
$configuration = [PesterConfiguration]::Default
@nohwnd
nohwnd / UnitTest1.cs
Created April 15, 2021 08:31
Writing output per test in MSTest
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Linq;
using System.Collections.Generic;
using System.IO;