@@ -412,53 +412,30 @@ public void As_UnitSystem_ThrowsArgumentNullExceptionIfNull()
412
412
[Fact]
413
413
public void ToUnit_UnitSystem_ReturnsValueInDimensionlessUnit()
414
414
{{
415
- Assert.Multiple(() =>
416
- {{
417
- var quantity = new { _quantity . Name } (value: 1, unit: { _baseUnitFullName } );
418
-
419
- { _quantity . Name } convertedQuantity = quantity.ToUnit(UnitSystem.SI);
420
-
421
- Assert.Equal({ _baseUnitFullName } , convertedQuantity.Unit);
422
- Assert.Equal(quantity.Value, convertedQuantity.Value);
423
- }}, () =>
424
- {{
425
- IQuantity<{ _unitEnumName } > quantity = new { _quantity . Name } (value: 1, unit: { _baseUnitFullName } );
426
-
427
- IQuantity<{ _unitEnumName } > convertedQuantity = quantity.ToUnit(UnitSystem.SI);
428
-
429
- Assert.Equal({ _baseUnitFullName } , convertedQuantity.Unit);
430
- Assert.Equal(quantity.Value, convertedQuantity.Value);
431
- }});
432
- }}
433
-
434
- [Fact]
435
- public void ToUnitUntyped_UnitSystem_ReturnsValueInDimensionlessUnit()
436
- {{
437
- IQuantity quantity = new { _quantity . Name } (value: 1, unit: { _baseUnitFullName } );
415
+ var quantity = new { _quantity . Name } (value: 1, unit: { _baseUnitFullName } );
438
416
439
- IQuantity convertedQuantity = quantity.ToUnitUntyped (UnitSystem.SI);
417
+ { _quantity . Name } convertedQuantity = quantity.ToUnit (UnitSystem.SI);
440
418
441
419
Assert.Equal({ _baseUnitFullName } , convertedQuantity.Unit);
442
420
Assert.Equal(quantity.Value, convertedQuantity.Value);
443
421
}}
444
422
445
-
446
423
[Fact]
447
424
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
448
425
{{
449
426
UnitSystem nullUnitSystem = null!;
450
427
Assert.Multiple(() =>
451
428
{{
452
429
var quantity = new { _quantity . Name } (value: 1, unit: { _quantity . Name } .BaseUnit);
453
- Assert.Throws<ArgumentNullException>(() => quantity.ToUnitUntyped (nullUnitSystem));
430
+ Assert.Throws<ArgumentNullException>(() => quantity.ToUnit (nullUnitSystem));
454
431
}}, () =>
455
432
{{
456
433
IQuantity<{ _unitEnumName } > quantity = new { _quantity . Name } (value: 1, unit: { _quantity . Name } .BaseUnit);
457
- Assert.Throws<ArgumentNullException>(() => quantity.ToUnitUntyped (nullUnitSystem));
434
+ Assert.Throws<ArgumentNullException>(() => quantity.ToUnit (nullUnitSystem));
458
435
}}, () =>
459
436
{{
460
437
IQuantity quantity = new { _quantity . Name } (value: 1, unit: { _quantity . Name } .BaseUnit);
461
- Assert.Throws<ArgumentNullException>(() => quantity.ToUnitUntyped (nullUnitSystem));
438
+ Assert.Throws<ArgumentNullException>(() => quantity.ToUnit (nullUnitSystem));
462
439
}});
463
440
}}
464
441
" ) ;
@@ -508,35 +485,7 @@ public virtual void ToUnit_UnitSystem_SI_ReturnsQuantityInSIUnits()
508
485
var expectedUnit = { _quantity . Name } .Info.GetDefaultUnit(UnitSystem.SI);
509
486
var expectedValue = quantity.As(expectedUnit);
510
487
511
- Assert.Multiple(() =>
512
- {{
513
- { _quantity . Name } quantityToConvert = quantity;
514
-
515
- { _quantity . Name } convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
516
-
517
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
518
- Assert.Equal(expectedValue, convertedQuantity.Value);
519
- }}, () =>
520
- {{
521
- IQuantity<{ _unitEnumName } > quantityToConvert = quantity;
522
-
523
- IQuantity<{ _unitEnumName } > convertedQuantity = quantityToConvert.ToUnit(UnitSystem.SI);
524
-
525
- Assert.Equal(expectedUnit, convertedQuantity.Unit);
526
- Assert.Equal(expectedValue, convertedQuantity.Value);
527
- }});
528
- }}
529
-
530
- [Fact]
531
- public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
532
- {{
533
- var quantity = new { _quantity . Name } (value: 1, unit: { _quantity . Name } .BaseUnit);
534
- var expectedUnit = { _quantity . Name } .Info.GetDefaultUnit(UnitSystem.SI);
535
- var expectedValue = quantity.As(expectedUnit);
536
-
537
- IQuantity quantityToConvert = quantity;
538
-
539
- IQuantity convertedQuantity = quantityToConvert.ToUnitUntyped(UnitSystem.SI);
488
+ { _quantity . Name } convertedQuantity = quantity.ToUnit(UnitSystem.SI);
540
489
541
490
Assert.Equal(expectedUnit, convertedQuantity.Unit);
542
491
Assert.Equal(expectedValue, convertedQuantity.Value);
@@ -546,46 +495,16 @@ public virtual void ToUnitUntyped_UnitSystem_SI_ReturnsQuantityInSIUnits()
546
495
public void ToUnit_UnitSystem_ThrowsArgumentNullExceptionIfNull()
547
496
{{
548
497
UnitSystem nullUnitSystem = null!;
549
- Assert.Multiple(() =>
550
- {{
551
- var quantity = new { _quantity . Name } (value: 1, unit: { _quantity . Name } .BaseUnit);
552
- Assert.Throws<ArgumentNullException>(() => quantity.ToUnit(nullUnitSystem));
553
- }}, () =>
554
- {{
555
- IQuantity<{ _unitEnumName } > quantity = new { _quantity . Name } (value: 1, unit: { _quantity . Name } .BaseUnit);
556
- Assert.Throws<ArgumentNullException>(() => quantity.ToUnit(nullUnitSystem));
557
- }});
558
- }}
559
-
560
- [Fact]
561
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentNullExceptionIfNull()
562
- {{
563
- UnitSystem nullUnitSystem = null!;
564
- IQuantity quantity = new { _quantity . Name } (value: 1, unit: { _quantity . Name } .BaseUnit);
565
- Assert.Throws<ArgumentNullException>(() => quantity.ToUnitUntyped(nullUnitSystem));
498
+ var quantity = new { _quantity . Name } (value: 1, unit: { _quantity . Name } .BaseUnit);
499
+ Assert.Throws<ArgumentNullException>(() => quantity.ToUnit(nullUnitSystem));
566
500
}}
567
501
568
502
[Fact]
569
503
public void ToUnit_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
570
504
{{
571
505
var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
572
- Assert.Multiple(() =>
573
- {{
574
- var quantity = new { _quantity . Name } (value: 1, unit: { _quantity . Name } .BaseUnit);
575
- Assert.Throws<ArgumentException>(() => quantity.ToUnit(unsupportedUnitSystem));
576
- }}, () =>
577
- {{
578
- IQuantity<{ _unitEnumName } > quantity = new { _quantity . Name } (value: 1, unit: { _quantity . Name } .BaseUnit);
579
- Assert.Throws<ArgumentException>(() => quantity.ToUnit(unsupportedUnitSystem));
580
- }});
581
- }}
582
-
583
- [Fact]
584
- public void ToUnitUntyped_UnitSystem_ThrowsArgumentExceptionIfNotSupported()
585
- {{
586
- var unsupportedUnitSystem = new UnitSystem(UnsupportedBaseUnits);
587
- IQuantity quantity = new { _quantity . Name } (value: 1, unit: { _quantity . Name } .BaseUnit);
588
- Assert.Throws<ArgumentException>(() => quantity.ToUnitUntyped(unsupportedUnitSystem));
506
+ var quantity = new { _quantity . Name } (value: 1, unit: { _quantity . Name } .BaseUnit);
507
+ Assert.Throws<ArgumentException>(() => quantity.ToUnit(unsupportedUnitSystem));
589
508
}}
590
509
" ) ;
591
510
}
0 commit comments