예제 #1
0
        public void CanAnnotate_should_throw_exception_if_nothing_defined()
        {
            var command = new AnnotateAsset();

            ValidationAssert.Throws(() => GuardAsset.CanAnnotate(command),
                                    new ValidationError("Either file name, slug, tags or metadata must be defined.", "FileName", "Slug", "Tags", "Metadata"));
        }
예제 #2
0
        public void CanAnnotate_should_throw_exception_if_nothing_defined()
        {
            var command = new AnnotateAsset();

            ValidationAssert.Throws(() => GuardAsset.CanAnnotate(command),
                                    new ValidationError("At least one property must be defined.", "FileName", "IsProtected", "Metadata", "Slug", "Tags"));
        }
예제 #3
0
        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);
        }
예제 #4
0
        public void CanAnnotate_should_not_throw_exception_if_names_are_different()
        {
            var command = new AnnotateAsset {
                FileName = "new-name", Slug = "new-slug"
            };

            GuardAsset.CanAnnotate(command, "asset-name", "asset-slug");
        }
예제 #5
0
        public void CanAnnotate_should_not_throw_exception_if_empty()
        {
            var command = new AnnotateAsset {
                AppId = appId
            };

            GuardAsset.CanAnnotate(command);
        }
예제 #6
0
        public void CanAnnotate_should_throw_exception_if_slugs_are_the_same()
        {
            var command = new AnnotateAsset {
                Slug = "asset-slug"
            };

            ValidationAssert.Throws(() => GuardAsset.CanAnnotate(command, "asset-name", "asset-slug"),
                                    new ValidationError("Asset has already this slug.", "Slug"));
        }