public void SetUp() { Func <IAggregateRootEntity> sutQuery = () => (IAggregateRootEntity)null; var givens = new[] { new object(), new object() }; Func <IAggregateRootEntity, object> when = _ => null; var throws = new Exception(); _sut = new ExceptionCentricAggregateQueryTestSpecification( sutQuery, givens, when, throws); }
public void RunReturnsExpectedResultWhenFailedBecauseNoExceptionOccurred() { var specification = new ExceptionCentricAggregateQueryTestSpecification( () => new FailNoExceptionCase(), new object[0], _ => ((FailNoExceptionCase)_).Fail(), FailNoExceptionCase.TheExpectedException); var result = _sut.Run(specification); Assert.That(result.Passed, Is.False); Assert.That(result.Failed, Is.True); Assert.That(result.ButEvents, Is.EqualTo(Optional <object[]> .Empty)); Assert.That(result.ButException, Is.EqualTo(Optional <Exception> .Empty)); Assert.That(result.ButResult, Is.EqualTo(new Optional <object>(FailNoExceptionCase.TheResult))); }
public void UsingDefaultCtorReturnsInstanceWithExpectedProperties() { Func <IAggregateRootEntity> sutQuery = () => (IAggregateRootEntity)null; var givens = new[] { new object(), new object() }; Func <IAggregateRootEntity, object> when = _ => null; var throws = new Exception(); var sut = new ExceptionCentricAggregateQueryTestSpecification( sutQuery, givens, when, throws); Assert.That(sut.SutFactory, Is.SameAs(sutQuery)); Assert.That(sut.Givens, Is.EquivalentTo(givens)); Assert.That(sut.When, Is.SameAs(when)); Assert.That(sut.Throws, Is.SameAs(throws)); }