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
[assembly: AggregateSource.GEventStore.GEventStoreIntegration] |
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
//Factory Assert impl | |
var result1 = specification1.When(specification1.SutFactory()); | |
var succeeded1 = result1.GetChanges().SequenceEqual(specification1.Thens); | |
//Command Assert impl | |
var sut5 = specification5.SutFactory(); | |
specification5.When(sut5); | |
var succeeded5 = sut5.GetChanges().SequenceEqual(specification5.Thens); |
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 class ImmutableXYZ { | |
public ImmutableXYZ() { | |
abc = ""; | |
def = 0; | |
haha = -1; | |
} | |
ImmutableXYZ(string abc, int def, int haha) { | |
this.abc = abc; | |
this.def = def; |
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 LocalClock { | |
public static LocalDate Today { | |
get { return Now.Date; } | |
} | |
public static LocalDateTime Now { | |
get { | |
return SystemClock.Instance.Now.InZone(BclDateTimeZone.ForSystemDefault()).LocalDateTime; | |
} | |
} |
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
namespace WhenSpecificationMeetsStructuralInspection { | |
//Read it like a story, the best part is the ending ... | |
public interface ISpecification<T> { | |
bool IsSatisfiedBy(T instance); | |
} | |
public class AndSpecification<T> : ISpecification<T> { | |
readonly ISpecification<T> leftOperand; | |
readonly ISpecification<T> rightOperand; |
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
namespace WhenSpecificationMeetsStructuralInspection { | |
public interface ISpecification<T> { | |
bool IsSatisfiedBy(T instance); | |
} | |
public abstract class Specification<T> : ISpecification<T> { | |
public static Specification<T> operator &(Specification<T> leftOperand, Specification<T> rightOperand) { | |
return new AndSpecification<T>(leftOperand, rightOperand); | |
} |
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
using NodaTime; | |
namespace FluentNodaTime { | |
public static class LocalTimeFluentSyntax { | |
public static LocalTime Hour(this int hour) { | |
return new LocalTime(hour, 0); | |
} | |
public static LocalTime Hour(this int hour, int minute) { | |
return new LocalTime(hour, minute); |
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 class MethodUnderTestBuilder() { | |
public IABCFactory ABCDependency { get; private set; } | |
public IXYZService XYZDependency { get; private set; } | |
YourSUT _sut; | |
Foo _foo; | |
Bar _bar; | |
public MethodUnderTestBuilder() { | |
//Configure the happy path |
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
[Test] | |
public void ConstructorSucceeeds() | |
{ | |
var id = new ConcertId(Guid.NewGuid()); | |
new ConstructorScenario(() => Concert.New(id)) | |
.Then(ConcertEvents.Planned(id)) | |
.Assert(); | |
} |
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 interface IEventCentricAggregateCommandTestRunner | |
{ | |
EventCentricAggregateCommandTestResult Run(EventCentricAggregateCommandTestSpecification specification); | |
} | |
public class EventCentricAggregateCommandTestRunner : IEventCentricAggregateCommandTestRunner | |
{ | |
readonly IEqualityComparer<object> _comparer; | |
public EventCentricAggregateCommandTestRunner(IEqualityComparer<object> comparer) |