diff --git a/src/EventStore.Plugins/Diagnostics/PluginDiagnosticsData.cs b/src/EventStore.Plugins/Diagnostics/PluginDiagnosticsData.cs index 6b37250..92d942f 100644 --- a/src/EventStore.Plugins/Diagnostics/PluginDiagnosticsData.cs +++ b/src/EventStore.Plugins/Diagnostics/PluginDiagnosticsData.cs @@ -25,12 +25,12 @@ public enum PluginDiagnosticsDataCollectionMode { /// By default it is a snapshot and will override previously collected data, by event name. /// public readonly record struct PluginDiagnosticsData() : IComparable, IComparable { - public static PluginDiagnosticsData None { get; } = new() { Source = null!, Data = null! }; - + public static PluginDiagnosticsData None { get; } = new() { Data = null! }; + /// /// The source of the event that matches the DiagnosticsName. /// - public required string Source { get; init; } + public string Source { get; init; } = string.Empty; /// /// The name of the event. The default is PluginDiagnosticsData. diff --git a/test/EventStore.Plugins.Tests/Diagnostics/PluginBaseTests.cs b/test/EventStore.Plugins.Tests/Diagnostics/PluginDiagnosticsDataTests.cs similarity index 88% rename from test/EventStore.Plugins.Tests/Diagnostics/PluginBaseTests.cs rename to test/EventStore.Plugins.Tests/Diagnostics/PluginDiagnosticsDataTests.cs index d61f7be..21701f8 100644 --- a/test/EventStore.Plugins.Tests/Diagnostics/PluginBaseTests.cs +++ b/test/EventStore.Plugins.Tests/Diagnostics/PluginDiagnosticsDataTests.cs @@ -1,5 +1,3 @@ -// ReSharper disable AccessToDisposedClosure - using EventStore.Plugins.Diagnostics; namespace EventStore.Plugins.Tests.Diagnostics; @@ -25,18 +23,16 @@ public void can_get_default_value_from_data(dynamic expectedValue) => static void gets_value_from_data(T expectedValue) { var sut = new PluginDiagnosticsData { - Source = "", - Data = new() { ["value"] = expectedValue } + Data = new() { ["value"] = expectedValue } }; sut.GetValue("value").Should() .BeEquivalentTo(expectedValue, $"because the retrieved value should be {typeof(T).Name}"); } - + static void gets_default_value_from_data(T expectedValue) { var sut = new PluginDiagnosticsData { - Source = "", - Data = new() + Data = new() }; sut.GetValue("missing-value", defaultValue: expectedValue)