public void CanRemoveLanguage_should_throw_exception_if_language_is_null()
        {
            var command = new RemoveLanguage();

            ValidationAssert.Throws(() => GuardAppLanguages.CanRemove(languages_0, command),
                                    new ValidationError("Language code is required.", "Language"));
        }
Esempio n. 2
0
        public void CanAddLanguage_should_throw_exception_if_language_already_added()
        {
            var command = new AddLanguage {
                Language = Language.DE
            };

            Assert.Throws <ValidationException>(() => GuardAppLanguages.CanAdd(languages_0, command));
        }
        public void CanAddLanguage_should_not_throw_exception_if_language_valid()
        {
            var command = new AddLanguage {
                Language = Language.EN
            };

            GuardAppLanguages.CanAdd(languages_0, command);
        }
        public void CanRemoveLanguage_should_not_throw_exception_if_language_is_valid()
        {
            var command = new RemoveLanguage {
                Language = Language.DE
            };

            GuardAppLanguages.CanRemove(languages, command);
        }
        public void CanRemoveLanguage_should_throw_exception_if_language_not_found()
        {
            var command = new RemoveLanguage {
                Language = Language.EN
            };

            Assert.Throws <DomainObjectNotFoundException>(() => GuardAppLanguages.CanRemove(languages_0, command));
        }
        public void CanUpdateLanguage_should_not_throw_exception_if_language_is_valid()
        {
            var command = new UpdateLanguage {
                Language = Language.DE, Fallback = new[] { Language.EN }
            };

            GuardAppLanguages.CanUpdate(languages, command);
        }
        public void CanUpdateLanguage_should_throw_exception_if_not_found()
        {
            var command = new UpdateLanguage {
                Language = Language.IT
            };

            Assert.Throws <DomainObjectNotFoundException>(() => GuardAppLanguages.CanUpdate(languages, command));
        }
Esempio n. 8
0
        public void CanUpdateLanguage_should_throw_exception_if_language_is_null()
        {
            var command = new UpdateLanguage();

            var languages_1 = languages_0.Set(new LanguageConfig(Language.EN));

            Assert.Throws <ValidationException>(() => GuardAppLanguages.CanUpdate(languages_1, command));
        }
Esempio n. 9
0
        public void CanRemoveLanguage_should_throw_exception_if_language_is_master()
        {
            var command = new RemoveLanguage {
                Language = Language.DE
            };

            Assert.Throws <ValidationException>(() => GuardAppLanguages.CanRemove(languages_0, command));
        }
Esempio n. 10
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(languages, command),
                                    new ValidationError("Master language cannot have fallback languages.", "Fallback"));
        }
Esempio n. 11
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(languages, command),
                                    new ValidationError("App does not have fallback language 'Italian'.", "Fallback"));
        }
        public void CanUpdateLanguage_should_throw_exception_if_language_is_null()
        {
            var command = new UpdateLanguage();

            var languages_1 = languages_0.Set(new LanguageConfig(Language.EN));

            ValidationAssert.Throws(() => GuardAppLanguages.CanUpdate(languages_1, command),
                                    new ValidationError("Language code is required.", "Language"));
        }
        public void CanAddLanguage_should_throw_exception_if_language_already_added()
        {
            var command = new AddLanguage {
                Language = Language.DE
            };

            ValidationAssert.Throws(() => GuardAppLanguages.CanAdd(languages_0, command),
                                    new ValidationError("Language has already been added."));
        }
Esempio n. 14
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(languages, command),
                                    new ValidationError("Master language cannot be made optional.", "IsMaster"));
        }
        public void CanRemoveLanguage_should_throw_exception_if_language_is_master()
        {
            var command = new RemoveLanguage {
                Language = Language.DE
            };

            ValidationAssert.Throws(() => GuardAppLanguages.CanRemove(languages_0, command),
                                    new ValidationError("Master language cannot be removed."));
        }
        public void CanRemoveLanguage_should_not_throw_exception_if_language_is_valid()
        {
            var command = new RemoveLanguage {
                Language = Language.EN
            };

            var languages_1 = languages_0.Set(new LanguageConfig(Language.EN));

            GuardAppLanguages.CanRemove(languages_1, command);
        }
Esempio n. 17
0
        public void CanUpdateLanguage_should_throw_exception_if_language_is_optional_and_master()
        {
            var command = new UpdateLanguage {
                Language = Language.DE, IsOptional = true
            };

            var languages_1 = languages_0.Set(new LanguageConfig(Language.EN));

            Assert.Throws <ValidationException>(() => GuardAppLanguages.CanUpdate(languages_1, command));
        }
Esempio n. 18
0
        public void CanUpdateLanguage_should_throw_exception_if_language_has_invalid_fallback()
        {
            var command = new UpdateLanguage {
                Language = Language.DE, Fallback = new List <Language> {
                    Language.IT
                }
            };

            var languages_1 = languages_0.Set(new LanguageConfig(Language.EN));

            Assert.Throws <ValidationException>(() => GuardAppLanguages.CanUpdate(languages_1, command));
        }
        public void CanUpdateLanguage_should_not_throw_exception_if_language_is_valid()
        {
            var command = new UpdateLanguage {
                Language = Language.DE, Fallback = new List <Language> {
                    Language.EN
                }
            };

            var languages_1 = languages_0.Set(new LanguageConfig(Language.EN));

            GuardAppLanguages.CanUpdate(languages_1, command);
        }
        public void CanUpdateLanguage_should_throw_exception_if_language_has_invalid_fallback()
        {
            var command = new UpdateLanguage {
                Language = Language.DE, Fallback = new List <Language> {
                    Language.IT
                }
            };

            var languages_1 = languages_0.Set(new LanguageConfig(Language.EN));

            ValidationAssert.Throws(() => GuardAppLanguages.CanUpdate(languages_1, command),
                                    new ValidationError("App does not have fallback language 'Italian'.", "Fallback"));
        }
Esempio n. 21
0
        public void CanAddLanguage_should_throw_exception_if_language_is_null()
        {
            var command = new AddLanguage();

            Assert.Throws <ValidationException>(() => GuardAppLanguages.CanAdd(languages_0, command));
        }