public void UsingDefaultConstructorReturnsInstanceWithExpectedProperties(Fact[] givens,
                                                                                 object when,
                                                                                 Fact[] thens)
        {
            var sut = new EventCentricTestSpecification(givens, when, thens);

            Assert.That(sut.Givens, Is.EquivalentTo(givens));
            Assert.That(sut.When, Is.SameAs(when));
            Assert.That(sut.Thens, Is.EquivalentTo(thens));
        }
        public void FailReturnsExpectedResult()
        {
            var sut    = new EventCentricTestSpecification(NoEvents, Message, NoEvents);
            var result = sut.Fail();

            Assert.That(result.Specification, Is.SameAs(sut));
            Assert.That(result.Passed, Is.False);
            Assert.That(result.Failed, Is.True);
            Assert.That(result.ButEvents, Is.EqualTo(Optional <Exception> .Empty));
            Assert.That(result.ButException, Is.EqualTo(Optional <Exception> .Empty));
        }
        public void WriteEventCentricTestSpecificationResultsInExpectedOutput(
            EventCentricTestSpecification specification, string result)
        {
            using (var writer = new StringWriter())
            {
                var sut = new TestSpecificationTextWriter(writer);

                sut.Write(specification);

                Assert.That(writer.ToString(), Is.EqualTo(result));
            }
        }
        public void FailWithActualEventsReturnsExpectedResult()
        {
            var sut = new EventCentricTestSpecification(NoEvents, Message, NoEvents);

            var actual = new[] { new Fact(Model.Identifier1, new object()) };

            var result = sut.Fail(actual);

            Assert.That(result.Specification, Is.SameAs(sut));
            Assert.That(result.Passed, Is.False);
            Assert.That(result.Failed, Is.True);
            Assert.That(result.ButEvents, Is.EqualTo(new Optional <Fact[]>(actual)));
            Assert.That(result.ButException, Is.EqualTo(Optional <Exception> .Empty));
        }
        public void DoesEqualItself()
        {
            var sut = new EventCentricTestSpecification(NoEvents, Message, NoEvents);

            Assert.That(sut.Equals((object)sut), Is.True);
        }
        public void DoesNotEqualObjectOfOtherType()
        {
            var sut = new EventCentricTestSpecification(NoEvents, Message, NoEvents);

            Assert.That(sut.Equals(new object()), Is.False);
        }
        public void DoesNotEqualNull()
        {
            var sut = new EventCentricTestSpecification(NoEvents, Message, NoEvents);

            Assert.That(sut.Equals(null), Is.False);
        }
        public void FailWithNullExceptionThrows()
        {
            var sut = new EventCentricTestSpecification(NoEvents, Message, NoEvents);

            Assert.Throws <ArgumentNullException>(() => { var _ = sut.Fail((Exception)null); });
        }
Esempio n. 9
0
 private EventCentricTestResult Run(EventCentricTestSpecification specification)
 {
     return(new EventCentricTestSpecificationRunner(CreateFactComparer(), _factRepository, _factRepository,
                                                    _handlerResolver.Object).Run(specification));
 }