diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 6fba4955..8d124e06 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "minicover": { - "version": "3.4.1", + "version": "3.4.8", "commands": [ "minicover" ] diff --git a/.gitignore b/.gitignore index 51be4933..1b2b14cd 100644 --- a/.gitignore +++ b/.gitignore @@ -329,3 +329,7 @@ ASALocalRun/ # MFractors (Xamarin productivity tool) working folder .mfractor/ + +coverage-hits/ +coverage.json +coveralls.json \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index b7a8e389..a8bbf9fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ after_success: - dotnet test --no-build ./test/OData.QueryBuilder.Test -c $CONFIGURATION -f netcoreapp3.1 - dotnet minicover uninstrument - dotnet minicover report - - dotnet minicover coverallsreport --output "coveralls.json" --service-name "travis-ci" --service-job-id $TRAVIS_JOB_ID + - dotnet minicover coverallsreport --service-name "travis-ci" --service-job-id $TRAVIS_JOB_ID before_deploy: - git checkout origin/main && git fetch && git remote set-url origin https://${GITHUB_OAUTH_TOKEN}@github.com/ZEXSM/OData.QueryBuilder.git - PR_TITLE=$(git log -1 --pretty='%f') diff --git a/OData.QueryBuilder.sln b/OData.QueryBuilder.sln index f839b7d0..308a2b38 100644 --- a/OData.QueryBuilder.sln +++ b/OData.QueryBuilder.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.30204.135 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32825.248 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{FA1582AB-A13D-44A4-A46D-2DAE1111A2BB}" EndProject @@ -13,6 +13,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OData.QueryBuilder.Test", " EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "items", "items", "{179F88B9-A06D-4505-9266-A5D66004601C}" ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore .travis.yml = .travis.yml README.md = README.md EndProjectSection @@ -24,7 +25,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{B8F3 EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OData.QueryBuilder.Benchmark", "test\OData.QueryBuilder.Benchmark\OData.QueryBuilder.Benchmark.csproj", "{3C66CF4E-8FA0-4E81-90DB-B22234A2670C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OData.QueryBuilder.Fakes", "test\OData.QueryBuilder.Fakes\OData.QueryBuilder.Fakes.csproj", "{421FF96A-2F4E-4589-AF2A-604FDC8BE2AC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OData.QueryBuilder.Fakes", "test\OData.QueryBuilder.Fakes\OData.QueryBuilder.Fakes.csproj", "{421FF96A-2F4E-4589-AF2A-604FDC8BE2AC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/OData.QueryBuilder/Extensions/StringExtensions.cs b/src/OData.QueryBuilder/Extensions/StringExtensions.cs index 6879d85e..70c45c6a 100644 --- a/src/OData.QueryBuilder/Extensions/StringExtensions.cs +++ b/src/OData.QueryBuilder/Extensions/StringExtensions.cs @@ -50,6 +50,7 @@ public static IEnumerable ReplaceWithStringBuilder(this ICollection collection.CollectionToQuery(), IEnumerable enumerable => enumerable.EnumerableToQuery(), Guid @guid => $"{@guid}", + decimal @decimal => Convert.ToString(@decimal, CultureInfo.InvariantCulture), _ => @object.GetType().IsPrimitive ? Convert.ToString(@object, CultureInfo.InvariantCulture) : $"'{@object}'", }; diff --git a/test/OData.QueryBuilder.Test/ODataQueryCollectionTest.cs b/test/OData.QueryBuilder.Test/ODataQueryCollectionTest.cs index cd342332..b28b7891 100644 --- a/test/OData.QueryBuilder.Test/ODataQueryCollectionTest.cs +++ b/test/OData.QueryBuilder.Test/ODataQueryCollectionTest.cs @@ -1503,6 +1503,21 @@ public void ODataQueryBuilder_Function_Length_Success() uri.Should().Be("ODataType?$filter=length(TypeCode) gt 0"); } + [Fact(DisplayName = "Try convert decimal => Success")] + public void ODataQueryBuilderList_Decimal_Success() + { + decimal decimalValue = 10.3M; + double doubleValue = 20; + + var uri = _odataQueryBuilderDefault + .For(s => s.ODataType) + .ByList() + .Filter(s => s.Sum == decimalValue && s.Money == doubleValue) + .ToUri(); + + uri.Should().Be("http://mock/odata/ODataType?$filter=Sum eq 10.3 and Money eq 20"); + } + [Fact(DisplayName = "Function Cast => Success")] public void ODataQueryBuilder_Function_Cast_Success() {