public void SetUp()
        {
            Func <IAggregateRootEntity> sutFactory = () => (IAggregateRootEntity)null;
            var givens = new[] { new object(), new object() };
            Action <IAggregateRootEntity> when = _ => { };
            var thens = new[] { new object(), new object() };

            _sut = new EventCentricAggregateCommandTestSpecification(
                sutFactory,
                givens,
                when,
                thens);
        }
Example #2
0
        public void RunReturnsExpectedResultWhenFailedBecauseOfDifferentContentOfEvents()
        {
            var specification = new EventCentricAggregateCommandTestSpecification(
                () => new FailEventCase(),
                new object[0],
                _ => ((FailEventCase)_).Fail(),
                new [] { new object() });

            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.TheEvents)));
            Assert.That(result.ButException, Is.EqualTo(Optional <Exception> .Empty));
        }
Example #3
0
        public void RunReturnsExpectedResultWhenPassed()
        {
            var specification = new EventCentricAggregateCommandTestSpecification(
                () => new PassCase(),
                new object[0],
                _ => { },
                new object[0]);

            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() };
            Action <IAggregateRootEntity> when = _ => { };
            var thens = new[] { new object(), new object() };

            var sut = new EventCentricAggregateCommandTestSpecification(
                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));
        }