public async Task CanCreate_should_not_throw_exception_when_added_to_root() { var command = new CreateAssetFolder { FolderName = "My Folder" }; await GuardAssetFolder.CanCreate(command, assetQuery); }
public async Task CanCreate_should_throw_exception_when_folder_name_not_defined() { var command = new CreateAssetFolder(); A.CallTo(() => assetQuery.FindAssetFolderAsync(command.ParentId)) .Returns(new List <IAssetFolderEntity>()); await ValidationAssert.ThrowsAsync(() => GuardAssetFolder.CanCreate(command, assetQuery), new ValidationError("Folder name is required.", "FolderName")); }
public async Task CanCreate_should_throw_exception_when_folder_not_found() { var command = new CreateAssetFolder { FolderName = "My Folder", ParentId = Guid.NewGuid() }; A.CallTo(() => assetQuery.FindAssetFolderAsync(command.ParentId)) .Returns(new List <IAssetFolderEntity>()); await ValidationAssert.ThrowsAsync(() => GuardAssetFolder.CanCreate(command, assetQuery), new ValidationError("Asset folder does not exist.", "ParentId")); }
public async Task CanCreate_should_not_throw_exception_when_folder_found() { var command = new CreateAssetFolder { FolderName = "My Folder", ParentId = Guid.NewGuid() }; A.CallTo(() => assetQuery.FindAssetFolderAsync(command.ParentId)) .Returns(new List <IAssetFolderEntity> { CreateFolder() }); await GuardAssetFolder.CanCreate(command, assetQuery); }