refactor: Rename ExceptionAssert.not_null -> NotNull

This commit is contained in:
John Colvin committed 2026-01-11 11:20:40 -05:00
1 parent cd34f9b1cb
commit 2aa25d4085
2 files changed
+9 -15

No files matched your search

@@ -140,7 +140,7 @@ namespace mbts.spark {
_vm = LadderVM.create(_bus, model, init_settings, settings_source);
_vm.settings_invalidated += _on_settings_invalidated;
var order_props = ExceptionAssert.not_null(_vm.order_properties_vm);
var order_props = ExceptionAssert.NotNull(_vm.order_properties_vm);
order_props.open_algo_popup_on_select = _ladder_conf.open_algo_popup_on_select;
order_props.use_algo_param_grid = _ladder_conf.use_algo_param_grid;
@@ -197,7 +197,7 @@ namespace mbts.spark {
if (!_settings_profiles_dirty) {
return;
}
ExceptionAssert.not_null(_vm);
ExceptionAssert.NotNull(_vm);
var curr = _vm.get_save_state();
if (_profile_id == 0) {
_settings = curr;
@@ -209,7 +209,7 @@ namespace mbts.spark {
}
void _on_user_settings(UserSettings us) {
ExceptionAssert.not_null(_vm);
ExceptionAssert.NotNull(_vm);
if (_settings_received) {
_ensure_synced();
if (_profile_id == 0) {
@@ -240,7 +240,7 @@ namespace mbts.spark {
// included in more than 1 profile's security criteria. In the meantime, simply
// use the first match.
if (lp.security_criteria?.includes(_security_md.security) ?? false) {
_settings = ExceptionAssert.not_null(lp.value);
_settings = ExceptionAssert.NotNull(lp.value);
_profile_id = lp.id;
break;
}
@@ -260,7 +260,7 @@ namespace mbts.spark {
}
void _open_settings_dialog() {
ExceptionAssert.not_null(_vm);
ExceptionAssert.NotNull(_vm);
// dialog vm
var dialog_vm = new ProfiledShellSettingsDialogVM<LadderSettings, LadderSettingsVM, LadderSettingsProfile>(
_profile_service,
@@ -13,12 +13,8 @@ namespace mbts.utils {
public static T of_type<T>(object? obj, [CallerArgumentExpression(nameof(obj))] string? name = null) =>
obj is T ? (T)obj : throw new ArgumentException($"Expected {typeof(T)}, actually {(obj?.GetType()?.ToString() ?? "null")}.", name);
public static T not_null<T>([NotNull] T? obj, [CallerArgumentExpression(nameof(obj))] string? name = null) {
if (obj is null) {
throw new ArgumentNullException(name ?? nameof(obj));
}
return obj;
}
public static T NotNull<T>([NotNull] T? obj, [CallerArgumentExpression(nameof(obj))] string? name = null) =>
Argument.NotNull(obj, name);
public static class Index {
public static void IsValid(int index, int length, bool canInsert = false) {
@@ -74,10 +70,8 @@ namespace mbts.utils {
public static T[] NotNullOrEmpty<T>([NotNull] T[]? argument, [CallerArgumentExpression(nameof(argument))] string? name = null) =>
argument?.Length > 0 ? argument : throw new ArgumentException("Must not be null or empty.", name);
public static void NotNull([NotNull] object? argument, [CallerArgumentExpression(nameof(argument))] string? name = null) {
if (argument == null)
throw new ArgumentNullException(name);
}
public static T NotNull<T>([NotNull] T? argument, [CallerArgumentExpression(nameof(argument))] string? name = null) =>
argument ?? throw new ArgumentNullException(name);
public static void Equals(object? argument, object? value, [CallerArgumentExpression(nameof(argument))] string? name = null) {
if (!object.Equals(argument, value)) {