microsoft/healthcare-shared-components

Public

mirrored from https://github.com/microsoft/healthcare-shared-componentsAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
1.0.0-1.0.79

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/Microsoft.Health.Core.UnitTests/Extensions/DecimalExtensionsTests.cs

29lines · modecode

1// -------------------------------------------------------------------------------------------------
2// Copyright (c) Microsoft Corporation. All rights reserved.
3// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
4// -------------------------------------------------------------------------------------------------
5
6using Xunit;
7
8namespace Microsoft.Health.Core.Extensions.UnitTests
9{
10 public class DecimalExtensionsTests
11 {
12 [Theory]
13 [InlineData("100", ".5")]
14 [InlineData("100.0", ".05")]
15 [InlineData("100.00", ".005")]
16 [InlineData("100.000", ".0005")]
17 [InlineData("100.010", ".0005")]
18 [InlineData("100.0000", ".00005")]
19 [InlineData("100.00000", ".000005")]
20 [InlineData("100.12345", ".000005")]
21 [InlineData(".1234567890123456789012345678", "0")]
22 public void GivenADecimal_WhenGetPrecisionModifierIsCalled_ThenCorrectDecimalIsReturned(string input, string expected)
23 {
24 var inputDecimal = decimal.Parse(input);
25 var expectedDecimal = decimal.Parse(expected);
26 Assert.Equal(expectedDecimal, inputDecimal.GetPrescisionModifier());
27 }
28 }
29}