コード例 #1
0
ファイル: GuardAssetTests.cs プロジェクト: sejohn2020/squidex
        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, assetQuery, command.ParentId);
        }
コード例 #2
0
ファイル: GuardAssetTests.cs プロジェクト: sejohn2020/squidex
        public async Task CanMove_should_not_throw_exception_when_added_to_root()
        {
            var command = new MoveAsset {
                AppId = appId
            };

            await GuardAsset.CanMove(command, assetQuery, DomainId.NewGuid());
        }
コード例 #3
0
        public async Task CanMove_should_throw_exception_when_folder_has_not_changed()
        {
            var command = new MoveAsset {
                ParentId = Guid.NewGuid()
            };

            await ValidationAssert.ThrowsAsync(() => GuardAsset.CanMove(command, assetQuery, command.ParentId),
                                               new ValidationError("Asset is already part of this folder.", "ParentId"));
        }
コード例 #4
0
ファイル: GuardAssetTests.cs プロジェクト: sejohn2020/squidex
        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, assetQuery, DomainId.NewGuid()),
                                               new ValidationError("Asset folder does not exist.", "ParentId"));
        }
コード例 #5
0
ファイル: GuardAssetTests.cs プロジェクト: sejohn2020/squidex
        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> {
                CreateFolder()
            });

            await GuardAsset.CanMove(command, assetQuery, DomainId.NewGuid());
        }