コード例 #1
0
ファイル: GuardAssetTests.cs プロジェクト: jwwinegard/squidex
        public void CanAnnotate_should_not_throw_exception_if_a_value_is_passed()
        {
            var command = new AnnotateAsset {
                AppId = appId, FileName = "new-name", Slug = "new-slug"
            };

            GuardAsset.CanAnnotate(command);
        }
コード例 #2
0
ファイル: GuardAssetTests.cs プロジェクト: Jaben/squidex
        public async Task CanMove_should_not_throw_exception_if_added_to_root()
        {
            var command = new MoveAsset {
                AppId = appId
            };

            await GuardAsset.CanMove(command, Asset(), assetQuery);
        }
コード例 #3
0
ファイル: GuardAssetTests.cs プロジェクト: Jaben/squidex
        public async Task CanDelete_should_not_throw_exception()
        {
            var command = new DeleteAsset {
                AppId = appId
            };

            await GuardAsset.CanDelete(command, Asset(), contentRepository);
        }
コード例 #4
0
ファイル: GuardAssetTests.cs プロジェクト: jwwinegard/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, Asset(parentId : command.ParentId), assetQuery);
        }
コード例 #5
0
ファイル: GuardAssetTests.cs プロジェクト: jwwinegard/squidex
        public void CanAnnotate_should_not_throw_exception_if_empty()
        {
            var command = new AnnotateAsset {
                AppId = appId
            };

            GuardAsset.CanAnnotate(command);
        }
コード例 #6
0
ファイル: GuardAssetTests.cs プロジェクト: jwwinegard/squidex
        public void CanCreate_should_not_throw_exception_when_added_to_root()
        {
            var command = new CreateAsset {
                AppId = appId
            };

            GuardAsset.CanCreate(command);
        }
コード例 #7
0
ファイル: GuardAssetTests.cs プロジェクト: jwwinegard/squidex
        public void CanUpdate_should_not_throw_exception()
        {
            var command = new UpdateAsset {
                AppId = appId
            };

            GuardAsset.CanUpdate(command);
        }
コード例 #8
0
ファイル: GuardAssetTests.cs プロジェクト: wensincai/squidex
        public async Task CanCreate_should_not_throw_exception_when_added_to_root()
        {
            var command = new CreateAsset {
                AppId = appId
            };

            await GuardAsset.CanCreate(command, assetQuery);
        }
コード例 #9
0
ファイル: GuardAssetTests.cs プロジェクト: jwwinegard/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, Asset(), assetQuery),
                                               new ValidationError("Asset folder does not exist.", "ParentId"));
        }
コード例 #10
0
ファイル: GuardAssetTests.cs プロジェクト: Jaben/squidex
        public async Task CanDelete_should_throw_exception_if_referenced()
        {
            var asset = Asset();

            var command = new DeleteAsset {
                AppId = appId, CheckReferrers = true
            };

            A.CallTo(() => contentRepository.HasReferrersAsync(appId.Id, asset.Id, SearchScope.All))
            .Returns(true);

            await Assert.ThrowsAsync <DomainException>(() => GuardAsset.CanDelete(command, asset, contentRepository));
        }
コード例 #11
0
ファイル: GuardAssetTests.cs プロジェクト: Jaben/squidex
        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);
        }
コード例 #12
0
ファイル: GuardAssetTests.cs プロジェクト: jwwinegard/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> {
                AssetFolder()
            });

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