Skip to content

Commit db16651

Browse files
linkdotnetegil
authored andcommitted
Small cleanup
1 parent 4b189fb commit db16651

7 files changed

Lines changed: 5 additions & 19 deletions

src/bunit.core/ComponentFactories/GenericComponentFactory{TComponent,TReplacementComponent}.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
62
using Microsoft.AspNetCore.Components;
73

84
namespace Bunit.ComponentFactories

src/bunit.core/ComponentParameterCollectionBuilder.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ public sealed class ComponentParameterCollectionBuilder<TComponent>
2525
private static bool HasUnmatchedCaptureParameter { get; }
2626
= typeof(TComponent).GetProperties(BindingFlags.Instance | BindingFlags.Public)
2727
.Select(x => x.GetCustomAttribute<ParameterAttribute>())
28-
.OfType<ParameterAttribute>()
29-
.Any(x => x.CaptureUnmatchedValues);
28+
.Any(x => x is {CaptureUnmatchedValues: true});
3029

3130
private readonly ComponentParameterCollection parameters = new();
3231

src/bunit.core/Extensions/TestContextBaseRenderExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Linq;
32
using Bunit.Rendering;
43
using Microsoft.AspNetCore.Components;
54

src/bunit.core/Rendering/FragmentContainer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Threading.Tasks;
22
using Microsoft.AspNetCore.Components;
3-
using Microsoft.AspNetCore.Components.Rendering;
43

54
namespace Bunit.Rendering
65
{

src/bunit.web/Asserting/CompareToExtensions.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ public static IReadOnlyList<IDiff> CompareTo(this INode actual, INodeList expect
6565
if (expected is null)
6666
throw new ArgumentNullException(nameof(expected));
6767

68-
var comparer = actual.GetHtmlComparer()
69-
?? expected.GetHtmlComparer()
70-
?? new HtmlComparer();
68+
var comparer = actual.GetHtmlComparer();
7169

7270
return comparer.Compare(expected, actual.AsEnumerable()).ToArray();
7371
}
@@ -86,9 +84,7 @@ public static IReadOnlyList<IDiff> CompareTo(this INodeList actual, INode expect
8684
if (expected is null)
8785
throw new ArgumentNullException(nameof(expected));
8886

89-
var comparer = expected.GetHtmlComparer()
90-
?? actual.GetHtmlComparer()
91-
?? new HtmlComparer();
87+
var comparer = expected.GetHtmlComparer();
9288

9389
return comparer.Compare(expected.AsEnumerable(), actual).ToArray();
9490
}
@@ -110,9 +106,7 @@ public static IReadOnlyList<IDiff> CompareTo(this INodeList actual, INodeList ex
110106
if (actual.Length == 0 && expected.Length == 0)
111107
return Array.Empty<IDiff>();
112108

113-
var comparer = actual.GetHtmlComparer()
114-
?? expected.GetHtmlComparer()
115-
?? new HtmlComparer();
109+
var comparer = actual.GetHtmlComparer();
116110

117111
return comparer.Compare(expected, actual).ToArray();
118112
}

src/bunit.web/Asserting/JSRuntimeAssertExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using AngleSharp.Dom;
44
using Bunit.Asserting;
5-
using Bunit.JSInterop;
65
using Bunit.JSInterop.InvocationHandlers;
76
using Microsoft.AspNetCore.Components;
87

src/bunit.web/Asserting/ShouldBeAdditionAssertExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static void ShouldBeAddition(this IDiff actualChange, INodeList expectedC
7575
if (actualChange is not UnexpectedNodeDiff actual)
7676
throw new DiffChangeAssertException(actualChange.Result, DiffResult.Unexpected, "The change was not an addition.");
7777

78-
var comparer = actual.Test.Node.GetHtmlComparer() ?? new HtmlComparer();
78+
var comparer = actual.Test.Node.GetHtmlComparer();
7979

8080
var diffs = comparer.Compare(expectedChange, actual.Test.Node.AsEnumerable()).ToList();
8181

0 commit comments

Comments
 (0)