internal static Exception NoHandler(string eventType) { EventBusException exception = new EventBusException(EventBusErrorCodes.NoHandler); exception.Data["EventType"] = eventType; return(exception); }
public void Constructor_WithoutArguments_Exception() { // Arrange & Act var exception = new EventBusException(); // Assert Assert.NotEmpty(exception.Message); Assert.Null(exception.InnerException); }
internal static Exception HandlerAlreadyExisted(string eventType, string brokerName) { EventBusException exception = new EventBusException(EventBusErrorCodes.HandlerAlreadyExisted); exception.Data["EventType"] = eventType; exception.Data["BrokerName"] = brokerName; return(exception); }
internal static Exception SettingsError(string eventName, string cause) { EventBusException exception = new EventBusException(EventBusErrorCodes.SettingsError); exception.Data["EventName"] = eventName; exception.Data["Cause"] = cause; return(exception); }
public void Constructor_Message_Exception() { // Arrange var message = Guid.NewGuid().ToString(); // Act var exception = new EventBusException(message); // Assert Assert.Equal(message, exception.Message); Assert.Null(exception.InnerException); }
public void Constructor_InnerException_Exception() { // Arrange var message = Guid.NewGuid().ToString(); var innerException = new InvalidOperationException("The operation is invalid"); // Act var exception = new EventBusException(message, innerException); // Assert Assert.NotNull(exception.InnerException); Assert.Equal(innerException, exception.InnerException); Assert.Equal(message, exception.Message); }
public void Constructor_Serealization_Exception() { // Arrange var message = Guid.NewGuid().ToString(); var innerException = new InvalidOperationException("The operation is invalid"); // Act var exception = new EventBusException(message, innerException); var bytes = SerializeToBytes(exception); var result = DeserializeFromBytes <EventBusException>(bytes); // Assert Assert.True(bytes.Length > 0); Assert.NotNull(result.Message); Assert.NotNull(result.InnerException); Assert.Equal(innerException, exception.InnerException); Assert.Equal(message, exception.Message); }