public void UsingDefaultConstructorReturnsInstanceWithExpectedProperties(Fact[] givens, object when, Exception throws) { var sut = new ExceptionCentricTestSpecification(givens, when, throws); Assert.That(sut.Givens, Is.EquivalentTo(givens)); Assert.That(sut.When, Is.SameAs(when)); Assert.That(sut.Throws, Is.SameAs(throws)); }
public void FailReturnsExpectedResult() { var sut = new ExceptionCentricTestSpecification(NoEvents, Message, Exception); 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.ButException, Is.EqualTo(Optional <Exception> .Empty)); }
public void WriteExceptionCentricTestSpecificationResultsInExpectedOutput( ExceptionCentricTestSpecification 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 ExceptionCentricTestSpecification(NoEvents, Message, Exception); 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)); }
private ExceptionCentricTestResult Run(ExceptionCentricTestSpecification specification) { return(new ExceptionCentricTestSpecificationRunner(CreateExceptionComparer(), _factRepository, _factRepository, _handlerResolver.Object).Run(specification)); }
public void DoesEqualItself() { var sut = new ExceptionCentricTestSpecification(NoEvents, Message, Exception); Assert.That(sut.Equals((object)sut), Is.True); }
public void DoesNotEqualObjectOfOtherType() { var sut = new ExceptionCentricTestSpecification(NoEvents, Message, Exception); Assert.That(sut.Equals(new object()), Is.False); }
public void DoesNotEqualNull() { var sut = new ExceptionCentricTestSpecification(NoEvents, Message, Exception); Assert.That(sut.Equals(null), Is.False); }
public void FailWithNullEventsThrows() { var sut = new ExceptionCentricTestSpecification(NoEvents, Message, Exception); Assert.Throws <ArgumentNullException>(() => { var _ = sut.Fail((Fact[])null); }); }