Skip to content

Remove Length2d #501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions UnitsNet.Tests/CustomCode/ForceTests.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Copyright (c) 2013 Andreas Gullberg Larsen ([email protected]).
// https://github.com/angularsen/UnitsNet
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -51,26 +51,19 @@ public void ForceDividedByAreaEqualsPressure()
}

[Fact]
public void PressureByAreaEqualsForceUsingArea()
public void PressureByAreaEqualsForce()
{
Force force = Force.FromPressureByArea(Pressure.FromNewtonsPerSquareMeter(5), Area.FromSquareMeters(7));
Assert.Equal(force, Force.FromNewtons(35));
}

[Fact]
public void PressureByAreaEqualsForceUsingLength2D()
{
var force = Force.FromPressureByArea(Pressure.FromNewtonsPerSquareMeter(6), Length2d.FromMeters(5, 2));
Assert.Equal(force, Force.FromNewtons(60));
}

[Fact]
public void ForceDividedByMassEqualsAcceleration()
{
Acceleration acceleration = Force.FromNewtons(27)/Mass.FromKilograms(9);
Assert.Equal(acceleration, Acceleration.FromMetersPerSecondSquared(3));
}

[Fact]
public void ForceDividedByAccelerationEqualsMass()
{
Expand All @@ -85,12 +78,6 @@ public void ForceDividedByLengthEqualsForcePerLength()
Assert.Equal(forcePerLength, ForcePerLength.FromNewtonsPerMeter(4));
}

[Fact]
public void MassByAccelerationEqualsForceUsingDouble()
{
var force = Force.FromMassByAcceleration(Mass.FromKilograms(9), 3);
Assert.Equal(force, Force.FromNewtons(27));
}
[Fact]
public void MassByAccelerationEqualsForce()
{
Expand Down
146 changes: 0 additions & 146 deletions UnitsNet.Tests/CustomCode/Length2dTests.cs

This file was deleted.

21 changes: 3 additions & 18 deletions UnitsNet/CustomCode/Quantities/Force.extra.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Copyright (c) 2013 Andreas Gullberg Larsen ([email protected]).
// https://github.com/angularsen/UnitsNet
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -66,21 +66,6 @@ public partial struct Force
}
#endif

// Method overloads with same number of argumnets not supported in Universal Windows Platform (WinRT Components)
#if !WINDOWS_UWP
public static Force FromPressureByArea(Pressure p, Length2d area)
{
double metersSquared = area.Meters.X * area.Meters.Y;
double newtons = p.Pascals * metersSquared;
return new Force(newtons, ForceUnit.Newton);
}

public static Force FromMassByAcceleration(Mass mass, double metersPerSecondSquared)
{
return new Force(mass.Kilograms * metersPerSecondSquared, ForceUnit.Newton);
}
#endif

public static Force FromPressureByArea(Pressure p, Area area)
{
double newtons = p.Pascals * area.SquareMeters;
Expand Down
Loading