Skip to content
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

use latest sdk #1055

Merged
merged 3 commits into from
Apr 26, 2021
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
15 changes: 7 additions & 8 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ stages:

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core SDK 3.x'
displayName: 'Use .NET Core SDK 5.x'
inputs:
version: 3.x
version: 5.x

- task: UseDotNet@2
displayName: 'Use .NET Core Runtime 2.1.x'
displayName: 'Use .NET Core Runtime 3.x'
inputs:
version: 2.1.x
packageType: runtime

version: 3.x
packageType: runtime

- task: DotNetCoreCLI@2
inputs:
Expand Down Expand Up @@ -76,14 +75,14 @@ stages:
arguments: install --tool-path . dotnet-reportgenerator-globaltool
displayName: Install ReportGenerator tool

- script: reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/Rx.NET/Source/coverlet/reports -reporttypes:"Cobertura"
- script: reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/coverlet/reports -reporttypes:"Cobertura"
displayName: Create reports

- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(Build.SourcesDirectory)/Rx.NET/Source/coverlet/reports/Cobertura.xml
summaryFileLocation: $(Build.SourcesDirectory)/coverlet/reports/Cobertura.xml

- publish: $(Build.ArtifactStagingDirectory)\Packages
displayName: Publish build packages
Expand Down
11 changes: 0 additions & 11 deletions src/Directory.Build.targets

This file was deleted.

4 changes: 2 additions & 2 deletions src/Humanizer.Tests/Humanizer.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net48;netcoreapp2.1</TargetFrameworks>
<TargetFrameworks>net48;net5.0;netcoreapp3.1</TargetFrameworks>
<Deterministic>false</Deterministic> <!-- Approver doesn't support this yet -->
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' ">
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' ">
<DefineConstants>$(DefineConstants);NETFX_CORE</DefineConstants>
</PropertyGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class ArmenianNumberToWordsConverter : GenderlessNumberToWordsConverter

public override string Convert(long number)
{
return Convert(number, false);
return ConvertImpl(number, false);
}

public override string ConvertToOrdinal(int number)
Expand All @@ -29,10 +29,10 @@ public override string ConvertToOrdinal(int number)
return exceptionString;
}

return Convert(number, true);
return ConvertImpl(number, true);
}

private string Convert(long number, bool isOrdinal)
private string ConvertImpl(long number, bool isOrdinal)
{
if (number == 0)
{
Expand All @@ -52,7 +52,7 @@ private string Convert(long number, bool isOrdinal)

if (number < 0)
{
return string.Format("մինուս {0}", Convert(-number, isOrdinal));
return string.Format("մինուս {0}", ConvertImpl(-number, isOrdinal));
}

var parts = new List<string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ public string Convert(long number)
return Convert(number, _defaultGender);
}

/// <summary>
/// Converts the number to string using the locale's default gramatical gender and adds "and"
/// </summary>
/// <param name="number"></param>
/// <param name="addAnd">Whether "and" should be included.</param>
/// <returns></returns>
public string Convert(long number, bool addAnd)
{
return Convert(number, _defaultGender);
Expand All @@ -29,6 +35,7 @@ public string Convert(long number, bool addAnd)
/// </summary>
/// <param name="number"></param>
/// <param name="gender"></param>
/// <param name="addAnd"></param>
/// <returns></returns>
public abstract string Convert(long number, GrammaticalGender gender, bool addAnd = true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ internal abstract class GenderlessNumberToWordsConverter : INumberToWordsConvert
/// <returns></returns>
public abstract string Convert(long number);

/// <summary>
/// Converts the number to string
/// </summary>
/// <param name="number"></param>
/// <param name="addAnd">Whether "and" should be included.</param>
/// <returns></returns>
public virtual string Convert(long number, bool addAnd)
{
return Convert(number);
Expand All @@ -19,6 +25,7 @@ public virtual string Convert(long number, bool addAnd)
/// </summary>
/// <param name="number"></param>
/// <param name="gender"></param>
/// <param name="addAnd"></param>
/// <returns></returns>
public virtual string Convert(long number, GrammaticalGender gender, bool addAnd = true)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ internal class GreekNumberToWordsConverter : GenderlessNumberToWordsConverter

public override string Convert(long number)
{
return Convert(number, false);
return ConvertImpl(number, false);
}

public override string ConvertToOrdinal(int number)
{
return null;
}

private string Convert(long number, bool returnPluralized)
private string ConvertImpl(long number, bool returnPluralized)
{
if (number < 13)
{
Expand Down Expand Up @@ -75,7 +75,7 @@ private string ConvertIntBH(long number, bool returnPluralized)
result += " ";
}

result += Convert(number % 10, returnPluralized).ToLower();
result += ConvertImpl(number % 10, returnPluralized).ToLower();
}

return result;
Expand All @@ -101,7 +101,7 @@ private string ConvertIntBT(long number, bool returnPluralized)

if (number % 100 != 0)
{
result += $" {Convert(number % 100, returnPluralized).ToLower()}";
result += $" {ConvertImpl(number % 100, returnPluralized).ToLower()}";
}

return result;
Expand All @@ -116,14 +116,14 @@ private string ConvertIntBM(long number)
return "χίλια";
}

return $"χίλια {Convert(number % 1000, false).ToLower()}";
return $"χίλια {ConvertImpl(number % 1000, false).ToLower()}";
}

var result = $"{Convert(number / 1000, true)} χιλιάδες";
var result = $"{ConvertImpl(number / 1000, true)} χιλιάδες";

if (number % 1000 != 0)
{
result += $" {Convert(number % 1000, false).ToLower()}";
result += $" {ConvertImpl(number % 1000, false).ToLower()}";
}

return result;
Expand All @@ -138,14 +138,14 @@ private string ConvertIntBB(long number)
return "ένα εκατομμύριο";
}

return $"ένα εκατομμύριο {Convert(number % 1000000, true).ToLower()}";
return $"ένα εκατομμύριο {ConvertImpl(number % 1000000, true).ToLower()}";
}

var result = $"{Convert(number / 1000000, false)} εκατομμύρια";
var result = $"{ConvertImpl(number / 1000000, false)} εκατομμύρια";

if (number % 1000000 != 0)
{
result += $" {Convert(number % 1000000, false).ToLower()}";
result += $" {ConvertImpl(number % 1000000, false).ToLower()}";
}

return result;
Expand All @@ -160,14 +160,14 @@ private string ConvertIntBTR(long number)
return "ένα δισεκατομμύριο";
}

return $"ένα δισεκατομμύριο {Convert(number % 1000000000, true).ToLower()}";
return $"ένα δισεκατομμύριο {ConvertImpl(number % 1000000000, true).ToLower()}";
}

var result = $"{Convert(number / 1000000000, false)} δισεκατομμύρια";
var result = $"{ConvertImpl(number / 1000000000, false)} δισεκατομμύρια";

if (number % 1000000000 != 0)
{
result += $" {Convert(number % 1000000000, false).ToLower()}";
result += $" {ConvertImpl(number % 1000000000, false).ToLower()}";
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public interface INumberToWordsConverter
/// Converts the number to string using the locale's default grammatical gender with or without adding 'And'
/// </summary>
/// <param name="number"></param>
/// <param name="addAnd">Specify with our without adding "And"</param>
/// <returns></returns>
string Convert(long number, bool addAnd);

Expand All @@ -24,6 +25,7 @@ public interface INumberToWordsConverter
/// </summary>
/// <param name="number"></param>
/// <param name="gender"></param>
/// <param name="addAnd"></param>
/// <returns></returns>
string Convert(long number, GrammaticalGender gender, bool addAnd = true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ internal class JapaneseNumberToWordsConverter : GenderlessNumberToWordsConverter

public override string Convert(long number)
{
return Convert(number, false);
return ConvertImpl(number, false);
}

public override string ConvertToOrdinal(int number)
{
return Convert(number, true);
return ConvertImpl(number, true);
}

private string Convert(long number, bool isOrdinal)
private string ConvertImpl(long number, bool isOrdinal)
{
if (number == 0)
{
Expand All @@ -28,7 +28,7 @@ private string Convert(long number, bool isOrdinal)

if (number < 0)
{
return string.Format("マイナス {0}", Convert(-number, false));
return string.Format("マイナス {0}", ConvertImpl(-number, false));
}

var parts = new List<string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ internal class TamilNumberToWordsConverter : GenderlessNumberToWordsConverter

public override string Convert(long number)
{
return Convert(number, false);
return ConvertImpl(number, false);
}

public override string ConvertToOrdinal(int number)
{
return Convert(number, true);
return ConvertImpl(number, true);
}

private string Convert(long number, bool isOrdinal)
private string ConvertImpl(long number, bool isOrdinal)
{
if (number == 0)
return GetUnitValue(0, isOrdinal);
Expand Down
2 changes: 1 addition & 1 deletion src/Humanizer/MetricNumeralExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private static string BuildMetricRepresentation(double input, int exponent, Metr
var symbol = Math.Sign(exponent) == 1
? Symbols[0][exponent - 1]
: Symbols[1][-exponent - 1];
return number
return number.ToString("G15")
+ (formats.HasValue && formats.Value.HasFlag(MetricNumeralFormats.WithSpace) ? " " : string.Empty)
+ GetUnitText(symbol, formats);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Humanizer/NumberToWordsExtension.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Globalization;
using System.Globalization;
using Humanizer.Configuration;

namespace Humanizer
Expand Down Expand Up @@ -62,6 +62,7 @@ public static string ToWords(this int number, GrammaticalGender gender, CultureI
/// </summary>
/// <param name="number">Number to be turned to words</param>
/// <param name="culture">Culture to use. If null, current thread's UI culture is used.</param>
/// <param name="addAnd">Whether "and" should be included or not.</param>
/// <returns></returns>
public static string ToWords(this long number, CultureInfo culture = null, bool addAnd = true)
{
Expand Down