public void SetUp() { Func <IAggregateRootEntity> sutFactory = () => (IAggregateRootEntity)null; var givens = new[] { new object(), new object() }; Action <IAggregateRootEntity> when = _ => { }; var throws = new Exception(); _sut = new ExceptionCentricAggregateCommandTestSpecification( sutFactory, givens, when, throws); }
public void RunReturnsExpectedResultWhenFailedBecauseNoExceptionOccurred() { var specification = new ExceptionCentricAggregateCommandTestSpecification( () => 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)); }
public void UsingDefaultCtorReturnsInstanceWithExpectedProperties() { Func <IAggregateRootEntity> sutFactory = () => (IAggregateRootEntity)null; var givens = new[] { new object(), new object() }; Action <IAggregateRootEntity> when = _ => { }; var throws = new Exception(); var sut = new ExceptionCentricAggregateCommandTestSpecification( sutFactory, givens, when, throws); Assert.That(sut.SutFactory, Is.SameAs(sutFactory)); Assert.That(sut.Givens, Is.EquivalentTo(givens)); Assert.That(sut.When, Is.SameAs(when)); Assert.That(sut.Throws, Is.SameAs(throws)); }