public void SetUp()
        {
            Func <IAggregateRootEntity> sutConstructor = () => (IAggregateRootEntity)null;
            var throws = new Exception();

            _sut = new ExceptionCentricAggregateConstructorTestSpecification(
                sutConstructor,
                throws);
        }
        public void UsingDefaultCtorReturnsInstanceWithExpectedProperties()
        {
            Func <IAggregateRootEntity> sutConstructor = () => (IAggregateRootEntity)null;
            var throws = new Exception();

            var sut = new ExceptionCentricAggregateConstructorTestSpecification(
                sutConstructor,
                throws);

            Assert.That(sut.SutFactory, Is.SameAs(sutConstructor));
            Assert.That(sut.Throws, Is.SameAs(throws));
        }
Exemple #3
0
        public void RunReturnsExpectedResultWhenFailedBecauseNoExceptionOccurred()
        {
            var specification = new ExceptionCentricAggregateConstructorTestSpecification(
                () => new FailNoExceptionCase(),
                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));
        }