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")); }
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")); }
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")); }
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")); }
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")); }
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")); }
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); }