Skip to content

Commit f677ec1

Browse files
authored
Remove Length2d (#501)
No reason why only Length should have this special type for 2 dimensions. We have later added Area and Volume to cover dimensions. Also removed some overloads taking `double` param for `Acceleration`.
1 parent 5d24432 commit f677ec1

File tree

4 files changed

+8
-443
lines changed

4 files changed

+8
-443
lines changed

UnitsNet.Tests/CustomCode/ForceTests.cs

+5-18
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
22
// https://github.com/angularsen/UnitsNet
3-
//
3+
//
44
// Permission is hereby granted, free of charge, to any person obtaining a copy
55
// of this software and associated documentation files (the "Software"), to deal
66
// in the Software without restriction, including without limitation the rights
77
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
88
// copies of the Software, and to permit persons to whom the Software is
99
// furnished to do so, subject to the following conditions:
10-
//
10+
//
1111
// The above copyright notice and this permission notice shall be included in
1212
// all copies or substantial portions of the Software.
13-
//
13+
//
1414
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1515
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1616
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -51,26 +51,19 @@ public void ForceDividedByAreaEqualsPressure()
5151
}
5252

5353
[Fact]
54-
public void PressureByAreaEqualsForceUsingArea()
54+
public void PressureByAreaEqualsForce()
5555
{
5656
Force force = Force.FromPressureByArea(Pressure.FromNewtonsPerSquareMeter(5), Area.FromSquareMeters(7));
5757
Assert.Equal(force, Force.FromNewtons(35));
5858
}
5959

60-
[Fact]
61-
public void PressureByAreaEqualsForceUsingLength2D()
62-
{
63-
var force = Force.FromPressureByArea(Pressure.FromNewtonsPerSquareMeter(6), Length2d.FromMeters(5, 2));
64-
Assert.Equal(force, Force.FromNewtons(60));
65-
}
66-
6760
[Fact]
6861
public void ForceDividedByMassEqualsAcceleration()
6962
{
7063
Acceleration acceleration = Force.FromNewtons(27)/Mass.FromKilograms(9);
7164
Assert.Equal(acceleration, Acceleration.FromMetersPerSecondSquared(3));
7265
}
73-
66+
7467
[Fact]
7568
public void ForceDividedByAccelerationEqualsMass()
7669
{
@@ -85,12 +78,6 @@ public void ForceDividedByLengthEqualsForcePerLength()
8578
Assert.Equal(forcePerLength, ForcePerLength.FromNewtonsPerMeter(4));
8679
}
8780

88-
[Fact]
89-
public void MassByAccelerationEqualsForceUsingDouble()
90-
{
91-
var force = Force.FromMassByAcceleration(Mass.FromKilograms(9), 3);
92-
Assert.Equal(force, Force.FromNewtons(27));
93-
}
9481
[Fact]
9582
public void MassByAccelerationEqualsForce()
9683
{

UnitsNet.Tests/CustomCode/Length2dTests.cs

-146
This file was deleted.

UnitsNet/CustomCode/Quantities/Force.extra.cs

+3-18
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// Copyright (c) 2013 Andreas Gullberg Larsen (andreas.larsen84@gmail.com).
22
// https://github.com/angularsen/UnitsNet
3-
//
3+
//
44
// Permission is hereby granted, free of charge, to any person obtaining a copy
55
// of this software and associated documentation files (the "Software"), to deal
66
// in the Software without restriction, including without limitation the rights
77
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
88
// copies of the Software, and to permit persons to whom the Software is
99
// furnished to do so, subject to the following conditions:
10-
//
10+
//
1111
// The above copyright notice and this permission notice shall be included in
1212
// all copies or substantial portions of the Software.
13-
//
13+
//
1414
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1515
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1616
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -66,21 +66,6 @@ public partial struct Force
6666
}
6767
#endif
6868

69-
// Method overloads with same number of argumnets not supported in Universal Windows Platform (WinRT Components)
70-
#if !WINDOWS_UWP
71-
public static Force FromPressureByArea(Pressure p, Length2d area)
72-
{
73-
double metersSquared = area.Meters.X * area.Meters.Y;
74-
double newtons = p.Pascals * metersSquared;
75-
return new Force(newtons, ForceUnit.Newton);
76-
}
77-
78-
public static Force FromMassByAcceleration(Mass mass, double metersPerSecondSquared)
79-
{
80-
return new Force(mass.Kilograms * metersPerSecondSquared, ForceUnit.Newton);
81-
}
82-
#endif
83-
8469
public static Force FromPressureByArea(Pressure p, Area area)
8570
{
8671
double newtons = p.Pascals * area.SquareMeters;

0 commit comments

Comments
 (0)