Exemple #1
0
        public async Task CanMove_should_not_throw_exception_if_added_to_root()
        {
            var command = new MoveAsset {
                AppId = appId
            };

            await GuardAsset.CanMove(command, Asset(), assetQuery);
        }
        public async Task CanMove_should_not_throw_exception_when_folder_has_not_changed()
        {
            var command = new MoveAsset {
                AppId = appId, ParentId = DomainId.NewGuid()
            };

            await GuardAsset.CanMove(command, Asset(parentId : command.ParentId), assetQuery);
        }
        public async Task CanMove_should_throw_exception_when_folder_not_found()
        {
            var command = new MoveAsset {
                AppId = appId, ParentId = DomainId.NewGuid()
            };

            A.CallTo(() => assetQuery.FindAssetFolderAsync(appId.Id, command.ParentId))
            .Returns(new List <IAssetFolderEntity>());

            await ValidationAssert.ThrowsAsync(() => GuardAsset.CanMove(command, Asset(), assetQuery),
                                               new ValidationError("Asset folder does not exist.", "ParentId"));
        }
Exemple #4
0
        public async Task CanMove_should_not_throw_exception_if_folder_not_found_but_optimized()
        {
            var parentId = DomainId.NewGuid();

            var command = new MoveAsset {
                AppId = appId, ParentId = parentId, OptimizeValidation = true
            };

            A.CallTo(() => assetQuery.FindAssetFolderAsync(appId.Id, command.ParentId))
            .Returns(new List <IAssetFolderEntity>());

            await GuardAsset.CanMove(command, Asset(), assetQuery);
        }
        public async Task CanMove_should_not_throw_exception_when_folder_found()
        {
            var command = new MoveAsset {
                AppId = appId, ParentId = DomainId.NewGuid()
            };

            A.CallTo(() => assetQuery.FindAssetFolderAsync(appId.Id, command.ParentId))
            .Returns(new List <IAssetFolderEntity> {
                AssetFolder()
            });

            await GuardAsset.CanMove(command, Asset(), assetQuery);
        }