public void GivenAnyExceptionWhenExceptionIsNotSuppliedThenBuilderShouldThrow() { // Arrange var sut = new DefaultErrorBuilder <Exception>(); // Act // Assert Assert.Throws <ArgumentNullException>(() => sut.Build(null, new List <Error>(), false)); }
public void GivenAnyExceptionWhenInternalErrorsAreNotSuppliedThenBuilderShouldThrow() { // Arrange var sut = new DefaultErrorBuilder <Exception>(); // Act // Assert Assert.Throws <ArgumentNullException>(() => sut.Build(new Exception(), null, false)); }
public void GivenAnyExceptionWhenErrorIsBuiltThenErrorWithExceptionContentsShouldBeCreated() { // Arrange var sut = new DefaultErrorBuilder <Exception>(); var exception = new Exception("My Error"); var internalErrors = new List <Error>(); // Act var result = sut.Build(exception, internalErrors, false); // Assert Assert.Equal("My Error", result.Message); Assert.Equal("Exception", result.ErrorType); Assert.Same(internalErrors, result.ChildErrors); }