|
18 | 18 | // </copyright> |
19 | 19 |
|
20 | 20 | using OpenQA.Selenium.DevTools.V130.Log; |
| 21 | +using System; |
21 | 22 | using System.Threading.Tasks; |
22 | 23 |
|
| 24 | +#nullable enable |
| 25 | + |
23 | 26 | namespace OpenQA.Selenium.DevTools.V130 |
24 | 27 | { |
25 | 28 | /// <summary> |
26 | 29 | /// Class containing the browser's log as referenced by version 130 of the DevTools Protocol. |
27 | 30 | /// </summary> |
28 | 31 | public class V130Log : DevTools.Log |
29 | 32 | { |
30 | | - private LogAdapter adapter; |
| 33 | + private readonly LogAdapter adapter; |
31 | 34 |
|
32 | 35 | /// <summary> |
33 | 36 | /// Initializes a new instance of the <see cref="V130Log"/> class. |
34 | 37 | /// </summary> |
35 | 38 | /// <param name="adapter">The adapter for the Log domain.</param> |
| 39 | + /// <exception cref="ArgumentNullException">If <paramref name="adapter"/> is <see langword="null"/>.</exception> |
36 | 40 | public V130Log(LogAdapter adapter) |
37 | 41 | { |
38 | | - this.adapter = adapter; |
| 42 | + this.adapter = adapter ?? throw new ArgumentNullException(nameof(adapter)); |
39 | 43 | this.adapter.EntryAdded += OnAdapterEntryAdded; |
40 | 44 | } |
41 | 45 |
|
@@ -66,14 +70,14 @@ public override async Task Clear() |
66 | 70 | await adapter.Clear().ConfigureAwait(false); |
67 | 71 | } |
68 | 72 |
|
69 | | - private void OnAdapterEntryAdded(object sender, Log.EntryAddedEventArgs e) |
| 73 | + private void OnAdapterEntryAdded(object? sender, Log.EntryAddedEventArgs e) |
70 | 74 | { |
71 | 75 | var entry = new LogEntry( |
72 | 76 | kind: e.Entry.Source.ToString(), |
73 | 77 | message: e.Entry.Text |
74 | 78 | ); |
75 | | - EntryAddedEventArgs propagated = new EntryAddedEventArgs(entry); |
76 | | - this.OnEntryAdded(propagated); |
| 79 | + |
| 80 | + this.OnEntryAdded(new EntryAddedEventArgs(entry)); |
77 | 81 | } |
78 | 82 | } |
79 | 83 | } |
0 commit comments