コード例 #1
0
        public void CanUpdateLanguage_should_throw_exception_if_language_is_null()
        {
            var command = new UpdateLanguage();

            ValidationAssert.Throws(() => GuardAppLanguages.CanUpdate(command, App(languages)),
                                    new ValidationError("Language code is required.", "Language"));
        }
コード例 #2
0
        public void CanAddLanguage_should_not_throw_exception_if_language_valid()
        {
            var command = new AddLanguage {
                Language = Language.IT
            };

            GuardAppLanguages.CanAdd(command, App(languages));
        }
コード例 #3
0
        public void CanRemoveLanguage_should_not_throw_exception_if_language_is_valid()
        {
            var command = new RemoveLanguage {
                Language = Language.DE
            };

            GuardAppLanguages.CanRemove(command, App(languages));
        }
コード例 #4
0
        public void CanRemoveLanguage_should_throw_exception_if_language_not_found()
        {
            var command = new RemoveLanguage {
                Language = Language.IT
            };

            Assert.Throws <DomainObjectNotFoundException>(() => GuardAppLanguages.CanRemove(command, App(languages)));
        }
コード例 #5
0
        public void CanUpdateLanguage_should_not_throw_exception_if_language_is_valid()
        {
            var command = new UpdateLanguage {
                Language = Language.DE, Fallback = new[] { Language.EN }
            };

            GuardAppLanguages.CanUpdate(command, App(languages));
        }
コード例 #6
0
        public void CanRemoveLanguage_should_throw_exception_if_language_is_master()
        {
            var command = new RemoveLanguage {
                Language = Language.EN
            };

            ValidationAssert.Throws(() => GuardAppLanguages.CanRemove(command, App(languages)),
                                    new ValidationError("Master language cannot be removed."));
        }
コード例 #7
0
        public void CanAddLanguage_should_throw_exception_if_language_already_added()
        {
            var command = new AddLanguage {
                Language = Language.EN
            };

            ValidationAssert.Throws(() => GuardAppLanguages.CanAdd(command, App(languages)),
                                    new ValidationError("Language has already been added."));
        }
コード例 #8
0
        public void CanUpdateLanguage_should_throw_exception_if_language_has_invalid_fallback()
        {
            var command = new UpdateLanguage {
                Language = Language.DE, Fallback = new[] { Language.IT }
            };

            ValidationAssert.Throws(() => GuardAppLanguages.CanUpdate(command, App(languages)),
                                    new ValidationError("App does not have fallback language 'Italian'.", "Fallback"));
        }
コード例 #9
0
        public void CanUpdateLanguage_should_throw_exception_if_fallback_language_defined_and_master()
        {
            var command = new UpdateLanguage {
                Language = Language.EN, Fallback = new[] { Language.DE }
            };

            ValidationAssert.Throws(() => GuardAppLanguages.CanUpdate(command, App(languages)),
                                    new ValidationError("Master language cannot have fallback languages.", "Fallback"));
        }
コード例 #10
0
        public void CanUpdateLanguage_should_throw_exception_if_language_is_optional_and_master()
        {
            var command = new UpdateLanguage {
                Language = Language.EN, IsOptional = true
            };

            ValidationAssert.Throws(() => GuardAppLanguages.CanUpdate(command, App(languages)),
                                    new ValidationError("Master language cannot be made optional.", "IsMaster"));
        }