Fixes #3242 - Replaces simple null checks (#3248)

* Replace all 342 `== null` with `is null`

* Replace 354 `!= null` with `is { }`

* Wrap these in conditionals since they break tests against Release configuration

The members they depend on do not exist in Release configuration

* Split these up and dispose properly

This test needs to be revisited for several reasons at some point.

* Fix release configuration tests

* Declare interface these already support

* Annotate constructor properly and use throw helper

* Move class to its own file

* Rename these files so they nest in the solution explorer

* Make this a record type and remove now-redundant/illegal members

* Reference passing to avoid some struct copies

* Simplify this

* Carry reference passing through as appropriate

* Turn this into a record struct

* Remove unused internal constructor and its test

It was only used by that test.

* Simplify this constructor

* This should be a property

* Simplify constructor

* Simplify GetHashCode

* Mark this ignored just in case

* Missed a couple of opportunities for reference passing

* record struct already does this by value

* Remove unused class

* Simplify the type initializer and Reset method

* Implement INotifyCollectionChanged and IDictionary by delegating to ColorSchemes

* Fix for reflection-based configuration

* Make CI  build happy by disambiguiating this attribute
This commit is contained in:
dodexahedron
2024-02-16 16:46:25 -07:00
committed by GitHub
parent 7a041fcc73
commit 34bef2c839
94 changed files with 1020 additions and 966 deletions

View File

@@ -23,8 +23,10 @@ public class ResponderTests
[Fact]
public void Disposing_Event_Notify_All_Subscribers_On_The_First_Container ()
{
#if DEBUG_IDISPOSABLE
// Only clear before because need to test after assert
Responder.Instances.Clear ();
#endif
var container1 = new View { Id = "Container1" };
var count = 0;
@@ -57,14 +59,18 @@ public class ResponderTests
container1.Dispose ();
#if DEBUG_IDISPOSABLE
Assert.Empty (Responder.Instances);
#endif
}
[Fact]
public void Disposing_Event_Notify_All_Subscribers_On_The_Second_Container ()
{
#if DEBUG_IDISPOSABLE
// Only clear before because need to test after assert
Responder.Instances.Clear ();
#endif
var container1 = new View { Id = "Container1" };
@@ -97,7 +103,9 @@ public class ResponderTests
container2.Dispose ();
#if DEBUG_IDISPOSABLE
Assert.Empty (Responder.Instances);
#endif
}
[Fact]
@@ -256,8 +264,9 @@ public class ResponderTests
public void Responder_Not_Notifying_Dispose ()
{
// Only clear before because need to test after assert
#if DEBUG_IDISPOSABLE
Responder.Instances.Clear ();
#endif
var container1 = new View { Id = "Container1" };
var view = new View { Id = "View" };
@@ -279,7 +288,9 @@ public class ResponderTests
Assert.Null (view.SuperView);
// Trying access disposed properties
#if DEBUG_IDISPOSABLE
Assert.True (container2.Subviews [0].WasDisposed);
#endif
Assert.False (container2.Subviews [0].CanFocus);
Assert.Null (container2.Subviews [0].Margin);
Assert.Null (container2.Subviews [0].Border);
@@ -288,7 +299,9 @@ public class ResponderTests
container2.Dispose ();
#if DEBUG_IDISPOSABLE
Assert.Empty (Responder.Instances);
#endif
}
public class DerivedView : View