Skip to content

Commit 9730bb4

Browse files
authored
Add Scalar quantity (#889)
e.g. Scalar.FromAmount(1.5).
1 parent 342377a commit 9730bb4

File tree

17 files changed

+2222
-0
lines changed

17 files changed

+2222
-0
lines changed

Common/UnitDefinitions/Scalar.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"Name": "Scalar",
3+
"BaseUnit": "Amount",
4+
"XmlDoc": "A way of representing a number of items.",
5+
"Units": [
6+
{
7+
"SingularName": "Amount",
8+
"PluralName": "Amount",
9+
"FromUnitToBaseFunc": "x",
10+
"FromBaseToUnitFunc": "x",
11+
"Localization": [
12+
{
13+
"Culture": "en-US",
14+
"Abbreviations": [ "" ]
15+
}
16+
]
17+
}
18+
]
19+
}

UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToScalarExtensionsTest.g.cs

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnitsNet.NumberExtensions/GeneratedCode/NumberToScalarExtensions.g.cs

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by \generate-code.bat.
4+
//
5+
// Changes to this file will be lost when the code is regenerated.
6+
// The build server regenerates the code before each build and a pre-build
7+
// step will regenerate the code on each local build.
8+
//
9+
// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
10+
//
11+
// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities.
12+
// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities.
13+
//
14+
// </auto-generated>
15+
//------------------------------------------------------------------------------
16+
17+
// Licensed under MIT No Attribution, see LICENSE file at the root.
18+
// Copyright 2013 Andreas Gullberg Larsen ([email protected]). Maintained at https://github.com/angularsen/UnitsNet.
19+
20+
using System;
21+
using Xunit;
22+
23+
namespace UnitsNet.Tests.CustomCode
24+
{
25+
public class ScalarTests : ScalarTestsBase
26+
{
27+
// Override properties in base class here
28+
protected override double AmountInOneAmount => 1;
29+
protected override bool SupportsSIUnitSystem => false;
30+
31+
}
32+
}

UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)