|
4 | 4 | using System.Diagnostics.CodeAnalysis;
|
5 | 5 | using System.Globalization;
|
6 | 6 | using Microsoft.Extensions.Primitives;
|
7 |
| -using Newtonsoft.Json.Linq; |
8 | 7 |
|
9 | 8 | namespace Microsoft.AspNetCore.Components.Endpoints.Binding;
|
10 | 9 |
|
11 |
| -public class FormDataDeserializerTests |
| 10 | +public class FormDataMapperTests |
12 | 11 | {
|
13 | 12 | [Theory]
|
14 | 13 | [MemberData(nameof(PrimitiveTypesData))]
|
@@ -286,35 +285,18 @@ public static bool TryParse([NotNullWhen(true)] string s, IFormatProvider provid
|
286 | 285 | }
|
287 | 286 | }
|
288 | 287 |
|
289 |
| - public override bool Equals(object obj) |
290 |
| - { |
291 |
| - return Equals(obj as Point); |
292 |
| - } |
| 288 | + public override bool Equals(object obj) => Equals(obj as Point); |
293 | 289 |
|
294 |
| - public bool Equals(Point other) |
295 |
| - { |
296 |
| - return other is not null && |
297 |
| - X == other.X && |
298 |
| - Y == other.Y; |
299 |
| - } |
| 290 | + public bool Equals(Point other) => other is not null && X == other.X && Y == other.Y; |
300 | 291 |
|
301 |
| - public override int GetHashCode() |
302 |
| - { |
303 |
| - return HashCode.Combine(X, Y); |
304 |
| - } |
| 292 | + public override int GetHashCode() => HashCode.Combine(X, Y); |
305 | 293 |
|
306 |
| - public static bool operator ==(Point left, Point right) |
307 |
| - { |
308 |
| - return EqualityComparer<Point>.Default.Equals(left, right); |
309 |
| - } |
| 294 | + public static bool operator ==(Point left, Point right) => EqualityComparer<Point>.Default.Equals(left, right); |
310 | 295 |
|
311 |
| - public static bool operator !=(Point left, Point right) |
312 |
| - { |
313 |
| - return !(left == right); |
314 |
| - } |
| 296 | + public static bool operator !=(Point left, Point right) => !(left == right); |
315 | 297 | }
|
316 | 298 |
|
317 |
| -internal class ValuePoint : IParsable<ValuePoint>, IEquatable<ValuePoint> |
| 299 | +internal struct ValuePoint : IParsable<ValuePoint>, IEquatable<ValuePoint> |
318 | 300 | {
|
319 | 301 | public int X { get; set; }
|
320 | 302 | public int Y { get; set; }
|
@@ -345,35 +327,18 @@ public static bool TryParse([NotNullWhen(true)] string s, IFormatProvider provid
|
345 | 327 | }
|
346 | 328 | catch (FormatException)
|
347 | 329 | {
|
348 |
| - result = null; |
| 330 | + result = default; |
349 | 331 | return false;
|
350 | 332 | }
|
351 | 333 | }
|
352 | 334 |
|
353 |
| - public override bool Equals(object obj) |
354 |
| - { |
355 |
| - return Equals(obj as ValuePoint); |
356 |
| - } |
| 335 | + public override bool Equals(object obj) => Equals((ValuePoint)obj); |
357 | 336 |
|
358 |
| - public bool Equals(ValuePoint other) |
359 |
| - { |
360 |
| - return other is not null && |
361 |
| - X == other.X && |
362 |
| - Y == other.Y; |
363 |
| - } |
| 337 | + public bool Equals(ValuePoint other) => X == other.X && Y == other.Y; |
364 | 338 |
|
365 |
| - public override int GetHashCode() |
366 |
| - { |
367 |
| - return HashCode.Combine(X, Y); |
368 |
| - } |
| 339 | + public override int GetHashCode() => HashCode.Combine(X, Y); |
369 | 340 |
|
370 |
| - public static bool operator ==(ValuePoint left, ValuePoint right) |
371 |
| - { |
372 |
| - return EqualityComparer<ValuePoint>.Default.Equals(left, right); |
373 |
| - } |
| 341 | + public static bool operator ==(ValuePoint left, ValuePoint right) => EqualityComparer<ValuePoint>.Default.Equals(left, right); |
374 | 342 |
|
375 |
| - public static bool operator !=(ValuePoint left, ValuePoint right) |
376 |
| - { |
377 |
| - return !(left == right); |
378 |
| - } |
| 343 | + public static bool operator !=(ValuePoint left, ValuePoint right) => !(left == right); |
379 | 344 | }
|
0 commit comments