public void ShouldBeAbleToSpecifyCommandTimeout() { // Arrange var cmd = new ShouldTimeout(); var threwSocketException = false; // Act try { CommandExecutor.Execute(cmd); } catch (MySqlException ex) { Exception current = ex; while ((current = current.InnerException) != null) { if (current is SocketException) { threwSocketException = true; break; } } } // Assert Expect(threwSocketException).To.Be.True(); }
public void ShouldBeAbleToProviderOnceOffExceptionHandler() { // Arrange var handler = new CustomHandler(); var cmd = new ShouldTimeout(handler); // Act Expect(() => CommandExecutor.Execute(cmd)) .Not.To.Throw(); // Assert Expect(handler.CaughtException) .Not.To.Be.Null(); Expect(handler.HandledOperation) .To.Equal(Operation.Insert); }