public void CreateFolder_FolderAlreadyExists_ThrowsFolderNameMustBeUniqueInParentRequestException() { var command = new CreateFolderCommand("newFolder", 3); var handlerSetup = CreateFoldersCommandHandlerFactory.CreateSetup( isUniqueInParent: false); var handler = handlerSetup.Handler; Should.Throw <FolderNameMustBeUniqueInParentRequestException>( async() => await handler.Handle(command, CancellationToken.None)); }
public void CreateFolder_ParentFolderDoesNotExists_ThrowsParentFolderDoesNotExistRequestException() { var command = new CreateFolderCommand("newFolder", 3); var handlerSetup = CreateFoldersCommandHandlerFactory.CreateSetup( exists: false); var handler = handlerSetup.Handler; Should.Throw <ParentFolderDoesNotExistRequestException>( async() => await handler.Handle(command, CancellationToken.None)); }
public async Task CreateFolder_ValidAndUniqueName_FolderIsCreatedWithCorrectValues(int?parentId) { var command = new CreateFolderCommand("newFolder", parentId); var handlerSetup = CreateFoldersCommandHandlerFactory.CreateSetup( exists: true, isUniqueInParent: true); var handler = handlerSetup.Handler; await handler.Handle(command, CancellationToken.None); handlerSetup.FoldersRepository.Verify( x => x.AddAsync(It.IsAny <Folder>()), Times.Once); }