From bb5e8bdc689596da9841075495850b8a1e0cce22 Mon Sep 17 00:00:00 2001
From: Jim Dale <26042891+jim-dale@users.noreply.github.com>
Date: Wed, 13 Dec 2023 18:13:22 +0000
Subject: [PATCH] port to .NET 8
---
.editorconfig | 38 +-
.github/workflows/dotnet-core.yml | 30 --
.github/workflows/ofxnet-pr.yml | 26 ++
BankingTools.sln | 9 +-
Directory.Build.props | 15 +-
OfxNet.IntegrationTests/OfxDocumentTests.cs | 95 ----
.../OfxNet.IntegrationTests.csproj | 49 --
OfxNet.UnitTests/OfxNet.UnitTests.csproj | 22 -
OfxNet.UnitTests/OfxParserTests.cs | 106 -----
OfxNet.UnitTests/SgmlOfxElementTests.cs | 31 --
OfxNet/IOfxElement.cs | 12 -
OfxNet/Models/OfxAccount.cs | 9 -
OfxNet/Models/OfxAccountBalance.cs | 10 -
OfxNet/Models/OfxAccountType.cs | 20 -
OfxNet/Models/OfxBankAccount.cs | 10 -
OfxNet/Models/OfxBankStatement.cs | 7 -
OfxNet/Models/OfxCorrectiveAction.cs | 13 -
OfxNet/Models/OfxCreditCardAccount.cs | 7 -
OfxNet/Models/OfxCreditCardStatement.cs | 7 -
OfxNet/Models/OfxCurrency.cs | 15 -
OfxNet/Models/OfxPayee.cs | 16 -
OfxNet/Models/OfxSeverity.cs | 15 -
OfxNet/Models/OfxSignOn.cs | 12 -
OfxNet/Models/OfxStatement.cs | 16 -
OfxNet/Models/OfxStatementTransaction.cs | 30 --
OfxNet/Models/OfxStatus.cs | 10 -
OfxNet/Models/OfxTransactionList.cs | 12 -
OfxNet/Models/OfxTransactionType.cs | 45 --
OfxNet/Models/OfxVersion.cs | 44 --
OfxNet/OfxConstants.cs | 101 ----
OfxNet/OfxDocument.cs | 438 ------------------
OfxNet/OfxDocumentSettings.cs | 18 -
OfxNet/OfxException.cs | 25 -
OfxNet/OfxParser.cs | 162 -------
OfxNet/Sgml/SgmlConstants.cs | 40 --
OfxNet/Sgml/SgmlDocument.cs | 35 --
OfxNet/Sgml/SgmlElement.cs | 65 ---
OfxNet/Sgml/SgmlHeader.cs | 16 -
OfxNet/Sgml/SgmlHeaderExtensions.cs | 47 --
OfxNet/Sgml/SgmlHeaderParser.cs | 163 -------
OfxNet/Sgml/SgmlParseException.cs | 26 --
OfxNet/Sgml/SgmlParseResult.cs | 22 -
OfxNet/Sgml/SgmlParser.cs | 165 -------
OfxNet/Sgml/SgmlTagType.cs | 10 -
OfxNet/Xml/XElementAdapter.cs | 42 --
README.md | 2 +-
src/OfxNet/IOfxElement.cs | 11 +
src/OfxNet/Models/OfxAccount.cs | 7 +
src/OfxNet/Models/OfxAccountBalance.cs | 9 +
src/OfxNet/Models/OfxAccountType.cs | 18 +
src/OfxNet/Models/OfxBankAccount.cs | 8 +
src/OfxNet/Models/OfxBankStatement.cs | 5 +
src/OfxNet/Models/OfxCorrectiveAction.cs | 12 +
src/OfxNet/Models/OfxCreditCardAccount.cs | 5 +
src/OfxNet/Models/OfxCreditCardStatement.cs | 5 +
src/OfxNet/Models/OfxCurrency.cs | 7 +
src/OfxNet/Models/OfxPayee.cs | 14 +
src/OfxNet/Models/OfxSeverity.cs | 14 +
src/OfxNet/Models/OfxSignOn.cs | 11 +
src/OfxNet/Models/OfxStatement.cs | 14 +
src/OfxNet/Models/OfxStatementTransaction.cs | 29 ++
src/OfxNet/Models/OfxStatus.cs | 8 +
src/OfxNet/Models/OfxTransactionList.cs | 11 +
src/OfxNet/Models/OfxTransactionType.cs | 44 ++
src/OfxNet/Models/OfxVersion.cs | 37 ++
src/OfxNet/OfxConstants.cs | 94 ++++
src/OfxNet/OfxDocument.cs | 429 +++++++++++++++++
src/OfxNet/OfxDocumentSettings.cs | 17 +
src/OfxNet/OfxException.cs | 24 +
{OfxNet => src/OfxNet}/OfxNet.csproj | 14 +-
src/OfxNet/OfxParser.cs | 167 +++++++
src/OfxNet/Sgml/SgmlConstants.cs | 33 ++
src/OfxNet/Sgml/SgmlDocument.cs | 35 ++
src/OfxNet/Sgml/SgmlElement.cs | 61 +++
src/OfxNet/Sgml/SgmlHeader.cs | 14 +
src/OfxNet/Sgml/SgmlHeaderExtensions.cs | 46 ++
src/OfxNet/Sgml/SgmlHeaderParser.cs | 161 +++++++
src/OfxNet/Sgml/SgmlParseException.cs | 25 +
src/OfxNet/Sgml/SgmlParseResult.cs | 20 +
src/OfxNet/Sgml/SgmlParser.cs | 165 +++++++
src/OfxNet/Sgml/SgmlTagType.cs | 8 +
src/OfxNet/Xml/XElementAdapter.cs | 39 ++
.../OfxDocumentTests.cs | 102 ++++
.../OfxNet.IntegrationTests.csproj | 24 +
.../Sample-Banco do Brasil.ofx | 0
.../OfxNet.IntegrationTests}/Sample-itau.ofx | 0
.../Sample-santander.ofx | 0
.../SampleBankStatement-1.ofx | 0
.../SampleBankStatement-2.ofx | 0
.../SampleCreditCardStatement.ofx | 0
.../SampleMultiStatement.ofx | 0
.../SampleSignOnResponse.ofx | 0
test/OfxNet.UnitTests/OfxNet.UnitTests.csproj | 17 +
test/OfxNet.UnitTests/OfxParserTests.cs | 105 +++++
test/OfxNet.UnitTests/SgmlOfxElementTests.cs | 30 ++
95 files changed, 1970 insertions(+), 2037 deletions(-)
delete mode 100644 .github/workflows/dotnet-core.yml
create mode 100644 .github/workflows/ofxnet-pr.yml
delete mode 100644 OfxNet.IntegrationTests/OfxDocumentTests.cs
delete mode 100644 OfxNet.IntegrationTests/OfxNet.IntegrationTests.csproj
delete mode 100644 OfxNet.UnitTests/OfxNet.UnitTests.csproj
delete mode 100644 OfxNet.UnitTests/OfxParserTests.cs
delete mode 100644 OfxNet.UnitTests/SgmlOfxElementTests.cs
delete mode 100644 OfxNet/IOfxElement.cs
delete mode 100644 OfxNet/Models/OfxAccount.cs
delete mode 100644 OfxNet/Models/OfxAccountBalance.cs
delete mode 100644 OfxNet/Models/OfxAccountType.cs
delete mode 100644 OfxNet/Models/OfxBankAccount.cs
delete mode 100644 OfxNet/Models/OfxBankStatement.cs
delete mode 100644 OfxNet/Models/OfxCorrectiveAction.cs
delete mode 100644 OfxNet/Models/OfxCreditCardAccount.cs
delete mode 100644 OfxNet/Models/OfxCreditCardStatement.cs
delete mode 100644 OfxNet/Models/OfxCurrency.cs
delete mode 100644 OfxNet/Models/OfxPayee.cs
delete mode 100644 OfxNet/Models/OfxSeverity.cs
delete mode 100644 OfxNet/Models/OfxSignOn.cs
delete mode 100644 OfxNet/Models/OfxStatement.cs
delete mode 100644 OfxNet/Models/OfxStatementTransaction.cs
delete mode 100644 OfxNet/Models/OfxStatus.cs
delete mode 100644 OfxNet/Models/OfxTransactionList.cs
delete mode 100644 OfxNet/Models/OfxTransactionType.cs
delete mode 100644 OfxNet/Models/OfxVersion.cs
delete mode 100644 OfxNet/OfxConstants.cs
delete mode 100644 OfxNet/OfxDocument.cs
delete mode 100644 OfxNet/OfxDocumentSettings.cs
delete mode 100644 OfxNet/OfxException.cs
delete mode 100644 OfxNet/OfxParser.cs
delete mode 100644 OfxNet/Sgml/SgmlConstants.cs
delete mode 100644 OfxNet/Sgml/SgmlDocument.cs
delete mode 100644 OfxNet/Sgml/SgmlElement.cs
delete mode 100644 OfxNet/Sgml/SgmlHeader.cs
delete mode 100644 OfxNet/Sgml/SgmlHeaderExtensions.cs
delete mode 100644 OfxNet/Sgml/SgmlHeaderParser.cs
delete mode 100644 OfxNet/Sgml/SgmlParseException.cs
delete mode 100644 OfxNet/Sgml/SgmlParseResult.cs
delete mode 100644 OfxNet/Sgml/SgmlParser.cs
delete mode 100644 OfxNet/Sgml/SgmlTagType.cs
delete mode 100644 OfxNet/Xml/XElementAdapter.cs
create mode 100644 src/OfxNet/IOfxElement.cs
create mode 100644 src/OfxNet/Models/OfxAccount.cs
create mode 100644 src/OfxNet/Models/OfxAccountBalance.cs
create mode 100644 src/OfxNet/Models/OfxAccountType.cs
create mode 100644 src/OfxNet/Models/OfxBankAccount.cs
create mode 100644 src/OfxNet/Models/OfxBankStatement.cs
create mode 100644 src/OfxNet/Models/OfxCorrectiveAction.cs
create mode 100644 src/OfxNet/Models/OfxCreditCardAccount.cs
create mode 100644 src/OfxNet/Models/OfxCreditCardStatement.cs
create mode 100644 src/OfxNet/Models/OfxCurrency.cs
create mode 100644 src/OfxNet/Models/OfxPayee.cs
create mode 100644 src/OfxNet/Models/OfxSeverity.cs
create mode 100644 src/OfxNet/Models/OfxSignOn.cs
create mode 100644 src/OfxNet/Models/OfxStatement.cs
create mode 100644 src/OfxNet/Models/OfxStatementTransaction.cs
create mode 100644 src/OfxNet/Models/OfxStatus.cs
create mode 100644 src/OfxNet/Models/OfxTransactionList.cs
create mode 100644 src/OfxNet/Models/OfxTransactionType.cs
create mode 100644 src/OfxNet/Models/OfxVersion.cs
create mode 100644 src/OfxNet/OfxConstants.cs
create mode 100644 src/OfxNet/OfxDocument.cs
create mode 100644 src/OfxNet/OfxDocumentSettings.cs
create mode 100644 src/OfxNet/OfxException.cs
rename {OfxNet => src/OfxNet}/OfxNet.csproj (71%)
create mode 100644 src/OfxNet/OfxParser.cs
create mode 100644 src/OfxNet/Sgml/SgmlConstants.cs
create mode 100644 src/OfxNet/Sgml/SgmlDocument.cs
create mode 100644 src/OfxNet/Sgml/SgmlElement.cs
create mode 100644 src/OfxNet/Sgml/SgmlHeader.cs
create mode 100644 src/OfxNet/Sgml/SgmlHeaderExtensions.cs
create mode 100644 src/OfxNet/Sgml/SgmlHeaderParser.cs
create mode 100644 src/OfxNet/Sgml/SgmlParseException.cs
create mode 100644 src/OfxNet/Sgml/SgmlParseResult.cs
create mode 100644 src/OfxNet/Sgml/SgmlParser.cs
create mode 100644 src/OfxNet/Sgml/SgmlTagType.cs
create mode 100644 src/OfxNet/Xml/XElementAdapter.cs
create mode 100644 test/OfxNet.IntegrationTests/OfxDocumentTests.cs
create mode 100644 test/OfxNet.IntegrationTests/OfxNet.IntegrationTests.csproj
rename {OfxNet.IntegrationTests => test/OfxNet.IntegrationTests}/Sample-Banco do Brasil.ofx (100%)
rename {OfxNet.IntegrationTests => test/OfxNet.IntegrationTests}/Sample-itau.ofx (100%)
rename {OfxNet.IntegrationTests => test/OfxNet.IntegrationTests}/Sample-santander.ofx (100%)
rename {OfxNet.IntegrationTests => test/OfxNet.IntegrationTests}/SampleBankStatement-1.ofx (100%)
rename {OfxNet.IntegrationTests => test/OfxNet.IntegrationTests}/SampleBankStatement-2.ofx (100%)
rename {OfxNet.IntegrationTests => test/OfxNet.IntegrationTests}/SampleCreditCardStatement.ofx (100%)
rename {OfxNet.IntegrationTests => test/OfxNet.IntegrationTests}/SampleMultiStatement.ofx (100%)
rename {OfxNet.IntegrationTests => test/OfxNet.IntegrationTests}/SampleSignOnResponse.ofx (100%)
create mode 100644 test/OfxNet.UnitTests/OfxNet.UnitTests.csproj
create mode 100644 test/OfxNet.UnitTests/OfxParserTests.cs
create mode 100644 test/OfxNet.UnitTests/SgmlOfxElementTests.cs
diff --git a/.editorconfig b/.editorconfig
index 111416e..7c9ca24 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -18,6 +18,7 @@ indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
+dotnet_diagnostic.CS1591.severity = none
# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,msbuildproj}]
@@ -66,7 +67,7 @@ dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
# Constants are PascalCase
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
-dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
+dotnet_naming_rule.constants_should_be_pascal_case.style = non_private_static_field_style
dotnet_naming_symbols.constants.applicable_kinds = field, local
dotnet_naming_symbols.constants.required_modifiers = const
@@ -76,7 +77,7 @@ dotnet_naming_style.constant_style.capitalization = pascal_case
# Static fields are camelCase
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
-dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
+dotnet_naming_rule.static_fields_should_be_camel_case.style = camel_case_style
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static
@@ -86,7 +87,7 @@ dotnet_naming_style.static_field_style.capitalization = camel_case
# Instance fields are camelCase
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
-dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
+dotnet_naming_rule.instance_fields_should_be_camel_case.style = camel_case_style
dotnet_naming_symbols.instance_fields.applicable_kinds = field
@@ -104,7 +105,7 @@ dotnet_naming_style.camel_case_style.capitalization = camel_case
# Local functions are PascalCase
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
-dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
+dotnet_naming_rule.local_functions_should_be_pascal_case.style = non_private_static_field_style
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
@@ -113,11 +114,26 @@ dotnet_naming_style.local_function_style.capitalization = pascal_case
# By default, name items with PascalCase
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
-dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
+dotnet_naming_rule.members_should_be_pascal_case.style = non_private_static_field_style
dotnet_naming_symbols.all_members.applicable_kinds = *
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
+dotnet_style_operator_placement_when_wrapping = beginning_of_line
+tab_width = 4
+end_of_line = crlf
+dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
+dotnet_style_prefer_auto_properties = true:silent
+dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
+dotnet_style_prefer_conditional_expression_over_assignment = true:silent
+dotnet_style_prefer_conditional_expression_over_return = true:silent
+dotnet_style_prefer_inferred_tuple_names = true:suggestion
+dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
+dotnet_style_prefer_compound_assignment = true:suggestion
+dotnet_style_prefer_collection_expression = true:suggestion
+dotnet_style_namespace_match_folder = true:suggestion
+dotnet_style_prefer_simplified_interpolation = true:suggestion
+dotnet_diagnostic.CA1001.severity = warning
# CSharp code style settings:
[*.cs]
@@ -166,6 +182,18 @@ dotnet_diagnostic.SA1130.severity = silent
# IDE1006: Naming Styles - StyleCop handles these for us
dotnet_diagnostic.IDE1006.severity = none
+csharp_using_directive_placement = inside_namespace:warning
+csharp_prefer_simple_using_statement = true:suggestion
+csharp_style_namespace_declarations = file_scoped:warning
+csharp_style_prefer_method_group_conversion = true:silent
+csharp_style_prefer_top_level_statements = false:silent
+csharp_style_expression_bodied_lambdas = true:silent
+csharp_style_expression_bodied_local_functions = false:silent
+csharp_style_prefer_primary_constructors = true:suggestion
+csharp_style_prefer_null_check_over_type_check = true:suggestion
+csharp_prefer_simple_default_expression = true:suggestion
+csharp_style_prefer_local_over_anonymous_function = true:suggestion
+csharp_style_prefer_index_operator = true:suggestion
[*.sln]
indent_style = tab
diff --git a/.github/workflows/dotnet-core.yml b/.github/workflows/dotnet-core.yml
deleted file mode 100644
index dcec561..0000000
--- a/.github/workflows/dotnet-core.yml
+++ /dev/null
@@ -1,30 +0,0 @@
-name: .NET Core
-
-on:
- push:
- branches: [ main ]
- pull_request:
- branches: [ main ]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
- - name: Setup .NET
- uses: actions/setup-dotnet@v1
- with:
- dotnet-version: 5.0.x
- - name: Install dependencies
- run: dotnet restore
- - name: Build
- run: dotnet build --configuration Release --no-restore
- - name: Test
- run: dotnet test --no-restore --verbosity normal
- - name: Publish
- uses: brandedoutcast/publish-nuget@v2.5.5
- with:
- PROJECT_FILE_PATH: "OfxNet/OfxNet.csproj"
- NUGET_KEY: ${{secrets.NUGET_APIKEY}}
diff --git a/.github/workflows/ofxnet-pr.yml b/.github/workflows/ofxnet-pr.yml
new file mode 100644
index 0000000..79176d1
--- /dev/null
+++ b/.github/workflows/ofxnet-pr.yml
@@ -0,0 +1,26 @@
+name: OFX.NET PR
+
+on:
+ pull_request:
+ branches: [ "main" ]
+
+env:
+ TreatWarningsAsErrors: true
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: '8.x'
+ - name: Restore dependencies
+ run: dotnet restore
+ - name: Build
+ run: dotnet build --configuration Release --no-restore
+ - name: Test
+ run: dotnet test --configuration Release --no-build
diff --git a/BankingTools.sln b/BankingTools.sln
index d84d1c5..33d48be 100644
--- a/BankingTools.sln
+++ b/BankingTools.sln
@@ -3,18 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OfxNet", "OfxNet\OfxNet.csproj", "{FB4B0B05-D087-464A-B03C-7B512AE0735D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OfxNet", "src\OfxNet\OfxNet.csproj", "{FB4B0B05-D087-464A-B03C-7B512AE0735D}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OfxNet.UnitTests", "OfxNet.UnitTests\OfxNet.UnitTests.csproj", "{4DBA4695-02D6-49C2-810A-DE8DFE7B70EB}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OfxNet.UnitTests", "test\OfxNet.UnitTests\OfxNet.UnitTests.csproj", "{4DBA4695-02D6-49C2-810A-DE8DFE7B70EB}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OfxNet.IntegrationTests", "OfxNet.IntegrationTests\OfxNet.IntegrationTests.csproj", "{1A1F0950-9156-44A0-BFE8-4E5B001F9A84}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OfxNet.IntegrationTests", "test\OfxNet.IntegrationTests\OfxNet.IntegrationTests.csproj", "{1A1F0950-9156-44A0-BFE8-4E5B001F9A84}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9820D1F4-882C-4CF1-8E02-71939CE4B3A7}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
- .github\workflows\dotnet-core.yml = .github\workflows\dotnet-core.yml
+ Directory.Build.props = Directory.Build.props
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
LICENSE = LICENSE
+ .github\workflows\ofxnet-pr.yml = .github\workflows\ofxnet-pr.yml
README.md = README.md
EndProjectSection
EndProject
diff --git a/Directory.Build.props b/Directory.Build.props
index e25422c..f0b3690 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,5 +1,18 @@
+ net7.0
+ enable
+ enable
+ 1.0.0.0
+ 1.0.0.0
+ 1.0.1.0
+ latest
+ true
true
+ true
+ x64
+ en-GB
+ Jim Dale
+ true
-
+
\ No newline at end of file
diff --git a/OfxNet.IntegrationTests/OfxDocumentTests.cs b/OfxNet.IntegrationTests/OfxDocumentTests.cs
deleted file mode 100644
index 51b08ef..0000000
--- a/OfxNet.IntegrationTests/OfxDocumentTests.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace OfxNet.IntegrationTests
-{
- [TestClass]
- public class OfxDocumentTests
- {
- public static IEnumerable