Skip to content

Instantly share code, notes, and snippets.

View bugthesystem's full-sized avatar
🦀
ƒ$€k( the( sψstem() ) )

ℤiλ∀ bugthesystem

🦀
ƒ$€k( the( sψstem() ) )
View GitHub Profile
#!/bin/bash
ELASTICSEARCH_VERSION=1.7
### Download and install the Public Signing Key
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
### Setup Repository
echo "deb http://packages.elastic.co/elasticsearch/${ELASTICSEARCH_VERSION}/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elk.list
@bugthesystem
bugthesystem / AssertExtensions.cs
Last active December 14, 2015 00:08
Assert helper method for async throw exceptions
public static class AssertExtensions
{
public static async Task ThrowsAsync<TException>(Func<Task> func) where TException : Exception
{
var expected = typeof(TException);
Type actual = null;
try
{
await func();
@bugthesystem
bugthesystem / MoqExtensions.cs
Last active October 10, 2015 19:07
Moq Sequences Revisited from http://haacked.com/archive/2010/11/24/moq-sequences-revisited.aspx Added ReturnsAsync method for c# 5.0 tests
public static class MoqExtensions
{
public static void ReturnsInOrder<T, TResult>(this ISetup<T, TResult> setup,
params object[] results) where T : class {
var queue = new Queue(results);
setup.Returns(() => {
var result = queue.Dequeue();
if (result is Exception) {
throw result as Exception;
}