Ejemplo n.º 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"));
        }
Ejemplo n.º 2
0
        public void CanAddLanguage_should_not_throw_exception_if_language_valid()
        {
            var command = new AddLanguage {
                Language = Language.IT
            };

            GuardAppLanguages.CanAdd(command, App(languages));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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)));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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."));
        }
Ejemplo n.º 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."));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }
Ejemplo n.º 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"));
        }