public void SetUp() { Func <IAggregateRootEntity> sutFactory = () => (IAggregateRootEntity)null; var givens = new[] { new object(), new object() }; Func <IAggregateRootEntity, IAggregateRootEntity> when = _ => null; var thens = new[] { new object(), new object() }; _sut = new EventCentricAggregateFactoryTestSpecification( sutFactory, givens, when, thens); }
public void RunReturnsExpectedResultWhenFailedBecauseOfDifferentContentOfEvents() { var specification = new EventCentricAggregateFactoryTestSpecification( () => new FailEventCase(), new object[0], _ => ((FailEventCase)_).Fail(), FailEventCase.TheExpectedEvents); var result = _sut.Run(specification); Assert.That(result.Passed, Is.False); Assert.That(result.Failed, Is.True); Assert.That(result.ButEvents, Is.EqualTo(new Optional <object[]>(FailEventCase.TheActualEvents))); Assert.That(result.ButException, Is.EqualTo(Optional <Exception> .Empty)); }
public void RunReturnsExpectedResultWhenPassed() { var specification = new EventCentricAggregateFactoryTestSpecification( () => new PassCase(), new object[0], _ => ((PassCase)_).Pass(), PassCase.TheExpectedEvents); var result = _sut.Run(specification); Assert.That(result.Passed, Is.True); Assert.That(result.Failed, Is.False); Assert.That(result.ButEvents, Is.EqualTo(Optional <object[]> .Empty)); Assert.That(result.ButException, Is.EqualTo(Optional <Exception> .Empty)); }
public void UsingDefaultCtorReturnsInstanceWithExpectedProperties() { Func <IAggregateRootEntity> sutFactory = () => (IAggregateRootEntity)null; var givens = new[] { new object(), new object() }; Func <IAggregateRootEntity, IAggregateRootEntity> when = _ => null; var thens = new[] { new object(), new object() }; var sut = new EventCentricAggregateFactoryTestSpecification( sutFactory, givens, when, thens); Assert.That(sut.SutFactory, Is.SameAs(sutFactory)); Assert.That(sut.Givens, Is.EquivalentTo(givens)); Assert.That(sut.When, Is.SameAs(when)); Assert.That(sut.Thens, Is.EquivalentTo(thens)); }