Skip to content

Instantly share code, notes, and snippets.

View yreynhout's full-sized avatar
👔
ceci n'est pas une cravate

Yves Reynhout yreynhout

👔
ceci n'est pas une cravate
View GitHub Profile
@yreynhout
yreynhout / Sql.cs
Last active January 2, 2016 22:19
Using Albedo for fun and profit ...
using Ploeh.Albedo; //among others
public static class Sql
{
public static ISqlParameterValue Null()
{
return SqlNullValue.Instance;
}
public static ISqlParameterValue VarChar(string value, int size)
[Fact]
public void returns_a_description_for_a_finished_build_that_failed()
{
var now = DateTimeOffset.UtcNow;
var started = -42.Seconds().RelativeTo(now);
var build = NewFailedBuild(1066, started);
var result = sut.GetBuildDescription(build, false, now);
Assert.Equal("Build #1066 failed in 42 seconds.", result);
@yreynhout
yreynhout / ESInTheBrowser.html
Last active December 27, 2015 02:29
Parking
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/json2/20121008/json2.js"></script>
<script>
var AggregateRootEntity =
function AggregateRootEntityConstructor(options, my) {
var that = {},
handlers = options.handlers || {},
changes = [];
public class BottlingMachine {
/* Behavior of the machine goes here */
}
//collection oriented
public interface BottlingMachineRepository {
BottlingMachine FindById(BottlingMachineId id);
BottlingMachine[] FindAtPlant(PlantId plantId);
BottlingMachine[] FindThoseDueForMaintenance();
using System;
using System.Collections.Generic;
using System.Linq;
using AggregateSource;
namespace TheStuff
{
class Program
{
static void Main()
@yreynhout
yreynhout / aggregatesource.py
Created September 14, 2013 16:50
In a nutshell of a snake
import json
class Event(object):
def __init__(self, name, data):
self.Name = name
self.Data = data
class AggregateRootEntity(object):
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using AggregateSource;
namespace StuffYouCanDo {
class Program {
static void Main() {
var @case = new PolymorphicSingularMeetsDynamicMeetsAnonymousShowCase();
//TODAY's IMPL
public interface IEventComparer
{
IEnumerable<EventComparisonDifference> Compare(object expected, object actual);
}
public interface IResultComparer
{
IEnumerable<ResultComparisonDifference> Compare(object expected, object actual);
public class TravisSpecs {
[Test]
public void WhenTravisGetsIntoAnotherFight() {
new ScenarioBuilder().
Given(TheStoryOfWhatHappenedToTravis())
When(TravisGetsInToANewFight()).
Then(HeRuns()).
Assert();
}
public class ChildRepository {
public Optional<Child> GetOptional(string identifier) {
//Very simple parent-child example
var childStream =_streamReader.Read(identifier);
var parentId = ((SomeInitialEvent)stream.Events[0]).ParentId;
var parentStream = _streamReader.Read(parentId);
var root = new Child();
root.Initialize(parentStream.Events);