public void CreateTicketResponseCommand_WithoutAnyInput_ShouldThrowValidationException() { var command = new CreateTicketResponseCommand(); FluentActions.Invoking(() => SendAsync(command)).Should().Throw <ValidationException>(); }
public async Task CreateTicketResponseCommand_WithoutConversationId_ShouldThrowValidationException() { var defaultUserId = await RunAsDefaultUserAsync(); var command = new CreateTicketResponseCommand { Message = "Test" }; FluentActions.Invoking(() => SendAsync(command)).Should().Throw <ValidationException>(); }
public async Task CreateTicketResponseCommand_WithoutMessage_ShouldThrowValidationException() { var createdTicketId = await SeedSampleTicket(); var command = new CreateTicketResponseCommand { ConversationId = createdTicketId }; FluentActions.Invoking(() => SendAsync(command)).Should().Throw <ValidationException>(); }
public void CreateTicketResponseCommand_WithInvalidConversationId_ShouldThrowNotFoundException() { var invalidConversationId = new Guid("ef1dc766-98f5-424f-ad4c-0fb42a690140"); var command = new CreateTicketResponseCommand { ConversationId = invalidConversationId, Message = "Test" }; FluentActions.Invoking(() => SendAsync(command)).Should().Throw <NotFoundException>(); }
public async Task CreateTicketResponseCommand_ForClosedTicket_ShouldThrowException() { var createdTicketId = await SeedSampleTicket(true); var command = new CreateTicketResponseCommand { ConversationId = createdTicketId, Message = "Test" }; FluentActions.Invoking(() => SendAsync(command)).Should().Throw <Exception>().Which.Message.Should().Be("You can't reply to closed ticket"); }
public async Task CreateTicketResponseCommand_WithDifferentUserThanAdmin_ShouldThrowForbiddenAccessException() { var createdTicketId = await SeedSampleTicket(); await RunAsAdministratorAsync(); var command = new CreateTicketResponseCommand { ConversationId = createdTicketId, Message = "Test" }; FluentActions.Invoking(() => SendAsync(command)).Should().Throw <ForbiddenAccessException>(); }
public async Task CreateTicketRepsonseCommand_WithValidInput_ShouldInsertTicketMessageAndReturnTicketMessageId() { var createdTicketId = await SeedSampleTicket(); var command = new CreateTicketResponseCommand { ConversationId = createdTicketId, Message = "Second Response" }; var ticketMessageId = await SendAsync(command); var ticketMessage = await FindAsync <ConversationMessage>(ticketMessageId); ticketMessage.Should().NotBeNull(); ticketMessage.Message.Should().Be("Second Response"); ticketMessage.Id.Should().Be(ticketMessageId); }