Example #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);
        }
Example #2
0
        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);
        }
Example #3
0
        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"));
        }
Example #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);
        }
Example #5
0
        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);
        }