Ejemplo n.º 1
0
        public void CanUpdateSettings_should_throw_exception_if_settings_is_null()
        {
            var command = new UpdateAppSettings();

            ValidationAssert.Throws(() => GuardApp.CanUpdateSettings(command),
                                    new ValidationError("Settings is required.", "Settings"));
        }
Ejemplo n.º 2
0
        public void CanUpdateSettings_should_throw_exception_if_editors_is_null()
        {
            var command = new UpdateAppSettings
            {
                Settings = new AppSettings
                {
                    Editors = null !
                }
            };

            ValidationAssert.Throws(() => GuardApp.CanUpdateSettings(command),
                                    new ValidationError("Editors is required.", "Settings.Editors"));
        }
Ejemplo n.º 3
0
        public void CanUpdateSettings_should_throw_exception_if_patterns_has_null_url()
        {
            var command = new UpdateAppSettings
            {
                Settings = new AppSettings
                {
                    Editors = ReadonlyList.Create(
                        new Editor("name", null !))
                }
            };

            ValidationAssert.Throws(() => GuardApp.CanUpdateSettings(command),
                                    new ValidationError("Url is required.", "Settings.Editors[0].Url"));
        }
Ejemplo n.º 4
0
        public void CanUpdateSettings_should_throw_exception_if_editors_has_null_name()
        {
            var command = new UpdateAppSettings
            {
                Settings = new AppSettings
                {
                    Editors = ReadonlyList.Create(
                        new Editor(null !, "[a-z]"))
                }
            };

            ValidationAssert.Throws(() => GuardApp.CanUpdateSettings(command),
                                    new ValidationError("Name is required.", "Settings.Editors[0].Name"));
        }
Ejemplo n.º 5
0
        public void CanUpdateSettings_should_throw_exception_if_patterns_has_null_regex()
        {
            var command = new UpdateAppSettings
            {
                Settings = new AppSettings
                {
                    Patterns = ReadonlyList.Create(
                        new Pattern("name", null !))
                }
            };

            ValidationAssert.Throws(() => GuardApp.CanUpdateSettings(command),
                                    new ValidationError("Regex is required.", "Settings.Patterns[0].Regex"));
        }
Ejemplo n.º 6
0
        public void CanUpdateSettings_should_throw_exception_if_patterns_has_null_name()
        {
            var command = new UpdateAppSettings
            {
                Settings = new AppSettings
                {
                    Patterns = ReadOnlyCollection.Create(
                        new Pattern(null !, "[a-z]"))
                }
            };

            ValidationAssert.Throws(() => GuardApp.CanUpdateSettings(command),
                                    new ValidationError("Name is required.", "Settings.Patterns[0].Name"));
        }
Ejemplo n.º 7
0
        public void CanUpdateSettings_should_not_throw_exception_if_setting_is_valid()
        {
            var command = new UpdateAppSettings
            {
                Settings = new AppSettings
                {
                    Patterns = ReadonlyList.Create(
                        new Pattern("name", "[a-z]")),
                    Editors = ReadonlyList.Create(
                        new Editor("name", "url/to/editor"))
                }
            };

            GuardApp.CanUpdateSettings(command);
        }