Skip to content

Instantly share code, notes, and snippets.


Renato Golia Kralizek

View GitHub Profile
View unit-test-lifecycle.cs
using System.Diagnostics;
using NUnit.Framework;
public class RootFixtureSetup
public void OneTimeSetUp() => Debug.WriteLine("RootFixtureSetup:OneTimeSetUp");
Kralizek / FizBuz.cs
Last active Nov 26, 2019
FizBuz using pattern matching and LINQ
View FizBuz.cs
Enumerable.Range(1, 100)
static (bool isFizz, bool isBuzz, int n) CheckModulo(int n)
return (n % 3 == 0, n % 5 == 0, n);
Kralizek /
Last active Mar 17, 2019
RabbitMQ service on ECS

Empty file to get a better name for the gist

Kralizek / SmartAutoDataAttribute.cs
Last active Mar 1, 2019
A C# attribute deriving from AutoDataAttribute in AutoFixture.NUnit3 that can be customized per test.
View SmartAutoDataAttribute.cs
public class SmartAutoDataAttribute : AutoDataAttribute
public SmartAutoDataAttribute() : base(() => CreateFixture(null)) { }
public SmartAutoDataAttribute(Type type, string methodName) : base(CreateFixtureWithMethod(type, methodName)) { }
private static Func<IFixture> CreateFixtureWithMethod(Type type, string methodName)
if (type == null)
Kralizek / QueueSubject.cs
Last active Jan 12, 2019
A Rx subject that stores all values until an observer subscribes.
View QueueSubject.cs
public class QueueSubject<T> : ISubject<T>
private readonly Subject<T> _subject = new Subject<T>();
private readonly Queue<Action<IObserver<T>>> _actions = new Queue<Action<IObserver<T>>>();
private bool _isCompleted = false;
private Exception _error;
public bool IsRunning => !_isCompleted && _error == null;
public bool HasObservers => _refCount > 0;
Kralizek / AutoMoqError.csproj
Created Jan 2, 2019
AutoMoq can't generate a mock for a delegate when in the signature of a test method
View AutoMoqError.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PackageReference Include="AutoFixture" Version="4.6.0" />
Kralizek / thats-me.txt
Created Jun 18, 2018
Do not look here
View thats-me.txt
Born in Napoli, Italy, living in Stockholm, Sweden. Passionate about distributed software architecture and .NET. Proud owner of a Windows 10 Mobile.
CTO at Educations Media Group ( @emgdev )
View docker-info.txt
C:\Users\Renato> docker info
Containers: 2
Running: 0
Paused: 0
Stopped: 2
Images: 2
Server Version: 18.03.1-ce
Storage Driver: lcow (linux) windowsfilter (windows)
Kralizek / aws-xray-docker.ps1
Last active Apr 30, 2018
Creates a Docker container to locally host an AWS XRay daemon.
View aws-xray-docker.ps1
# Fetches credentials from default profile
# It uses the AWS Powershell cmdlet
$credentials = (Get-AWSCredentials -ProfileName default).GetCredentials()
$accessKey = $credentials.AccessKey
$secretKey = $credentials.SecretKey
# Creates a container for later reuse
docker create -p 2000:2000/udp -e AWS_ACCESS_KEY_ID=$accessKey -e AWS_SECRET_ACCESS_KEY=$secretKey -e AWS_REGION=eu-west-1 --name aws-xray namshi/aws-xray
# Starts the container
View developer-enterprise.txt
#--- Initial Windows Config ---
Update-ExecutionPolicy Unrestricted
Set-WindowsExplorerOptions -EnableShowFileExtensions -EnableShowFullPathInTitleBar -DisableOpenFileExplorerToQuickAccess
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneExpandToCurrentFolder -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneShowAllFolders -Value 1
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Value 1