Skip to content

Commit

Permalink
Migrate from .NET Framwork 4.5 to .NET Standard 2.0 (#15)
Browse files Browse the repository at this point in the history
* Add build action
* Enable code scanning alerts
* Use guard from fundamentals to replace Ensure
* Removed obsolete spec test project
* Migrated to new project format
* Removed obsolete nuget and stylecop settings
* Updated readme
* Updated packages
  * xunit from 1.9.2 to 2.4.1
  * FakeItEasy from 1.25.1 to 7.1.0
  * FluentAssertions from 3.2.2 to 6.0.0
  • Loading branch information
dav1dev authored Aug 17, 2021
1 parent 273cb7f commit c7ce60c
Show file tree
Hide file tree
Showing 48 changed files with 497 additions and 870 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '39 4 * * 4'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
29 changes: 29 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: .NET

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:

build:

runs-on: windows-latest
strategy:
fail-fast: false
env:
SOLUTION: "./source/Appccelerate.IO.sln"
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- name: Restore dependencies
run: dotnet restore $env:SOLUTION
- name: Build
run: dotnet build $env:SOLUTION --no-restore
- name: Test
run: dotnet test $env:SOLUTION --no-build --verbosity normal
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Appccelrate.IO
# Appccelrate.IO

Simplifies interaction with the file system.
Simplifies interaction with the file system on Windows. Other operating systems than Windows are not supported.

Documentation at http://www.appccelerate.com/io.html
Documentation at [appccelerate.github.io/io](http://appccelerate.github.io/io.html)
44 changes: 44 additions & 0 deletions source/Analyzers.Facts.ruleset
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Analyzers" ToolsVersion="15.0">
<IncludeAll Action="Warning" />
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1000" Action="Warning" />
<Rule Id="CA1006" Action="None" />
<Rule Id="CA1014" Action="None" />
<Rule Id="CA1017" Action="None" />
<Rule Id="CA1034" Action="None" />
<Rule Id="CA1040" Action="None" />
<Rule Id="CA1303" Action="None" />
<Rule Id="CA1305" Action="None" />
<Rule Id="CA1502" Action="None" />
<Rule Id="CA1506" Action="None" />
<Rule Id="CA1704" Action="None" />
<Rule Id="CA1815" Action="None" />
<Rule Id="CA1822" Action="None" />
<Rule Id="CA2000" Action="None" />
<Rule Id="CA2204" Action="None" />
<Rule Id="CA2210" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp" RuleNamespace="Microsoft.CodeAnalysis.CSharp">
<Rule Id="CS1591" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Features" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Features">
<Rule Id="IDE0001" Action="None" />
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA0001" Action="None" />
<Rule Id="SA1008" Action="None" />
<Rule Id="SA1009" Action="None" />
<Rule Id="SA1101" Action="None" />
<Rule Id="SA1118" Action="None" />
<Rule Id="SA1135" Action="None" />
<Rule Id="SA1201" Action="None" />
<Rule Id="SA1202" Action="None" />
<Rule Id="SA1204" Action="None" />
<Rule Id="SA1407" Action="None" />
<Rule Id="SA1413" Action="None" />
<Rule Id="SA1600" Action="None" />
<Rule Id="SA1633" Action="Warning" />
<Rule Id="SA1652" Action="None" />
</Rules>
</RuleSet>
48 changes: 48 additions & 0 deletions source/Analyzers.Productive.ruleset
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Analyzers" ToolsVersion="15.0">
<IncludeAll Action="Warning" />
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<Rule Id="CA1000" Action="Warning" />
<Rule Id="CA1006" Action="None" />
<Rule Id="CA1014" Action="None" />
<Rule Id="CA1017" Action="None" />
<Rule Id="CA1034" Action="None" />
<Rule Id="CA1040" Action="None" />
<Rule Id="CA1303" Action="None" />
<Rule Id="CA1305" Action="None" />
<Rule Id="CA1502" Action="None" />
<Rule Id="CA1506" Action="None" />
<Rule Id="CA1704" Action="None" />
<Rule Id="CA1815" Action="None" />
<Rule Id="CA1822" Action="None" />
<Rule Id="CA2000" Action="None" />
<Rule Id="CA2204" Action="None" />
<Rule Id="CA2210" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp" RuleNamespace="Microsoft.CodeAnalysis.CSharp">
<Rule Id="CS1591" Action="None" />
</Rules>
<Rules AnalyzerId="Microsoft.CodeAnalysis.CSharp.Features" RuleNamespace="Microsoft.CodeAnalysis.CSharp.Features">
<Rule Id="IDE0001" Action="None" />
</Rules>
<Rules AnalyzerId="Particular.CodeRules" RuleNamespace="Particular.CodeRules">
<Rule Id="PCR0001" Action="None" />
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA1008" Action="None" />
<Rule Id="SA1009" Action="None" />
<Rule Id="SA1115" Action="None" />
<Rule Id="SA1118" Action="None" />
<Rule Id="SA1135" Action="None" />
<Rule Id="SA1201" Action="None" />
<Rule Id="SA1202" Action="None" />
<Rule Id="SA1204" Action="None" />
<Rule Id="SA1407" Action="None" />
<Rule Id="SA1413" Action="None" />
<Rule Id="SA1600" Action="None" />
<Rule Id="SA1601" Action="None" />
<Rule Id="SA1602" Action="None" />
<Rule Id="SA1633" Action="Warning" />
<Rule Id="SA1652" Action="None" />
</Rules>
</RuleSet>
4 changes: 2 additions & 2 deletions source/Appccelerate.IO.Facts/AbsoluteFilePathFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ public void ThrowsException_WhenPathIsAFolder()
{
Action action = () => new AbsoluteFilePath(FolderPath);

action.ShouldThrow<ArgumentException>();
action.Should().Throw<ArgumentException>();
}

[Fact]
public void ThrowsException_WhenPathIsNotAbsolute()
{
Action action = () => new AbsoluteFilePath(@".\file");

action.ShouldThrow<ArgumentException>();
action.Should().Throw<ArgumentException>();
}

[Theory]
Expand Down
2 changes: 1 addition & 1 deletion source/Appccelerate.IO.Facts/AbsoluteFolderPathFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void ThrowsException_WhenPathIsNotAbsolute()
{
Action action = () => new AbsolutePath(@"..\folder\");

action.ShouldThrow<ArgumentException>();
action.Should().Throw<ArgumentException>();
}

[Theory]
Expand Down
2 changes: 1 addition & 1 deletion source/Appccelerate.IO.Facts/AbsolutePathFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void ThrowsException_WhenPathIsNotAbsolute()
{
Action action = () => new AbsolutePath("..\folder\file.ext");

action.ShouldThrow<ArgumentException>();
action.Should().Throw<ArgumentException>();
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void ThrowsIOExceptionOnDeletingADirectory_WhenDirectoryContainsAFile()

Action action = () => this.testee.Delete(Folder);

action.ShouldThrow<IOException>();
action.Should().Throw<IOException>();
}

[Fact]
Expand All @@ -67,7 +67,7 @@ public void ThrowsIOExceptionOnDeletingADirectory_WhenDirectoryContainsASubDirec

Action action = () => this.testee.Delete(Folder);

action.ShouldThrow<IOException>();
action.Should().Throw<IOException>();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void CopyDoesNotOverwriteExistingFileContentByDefault()

Action action = () => this.testee.Copy(SourceFile, DestinationFile);

action.ShouldThrow<IOException>();
action.Should().Throw<IOException>();
this.fileSystem.GetFile(DestinationFile)
.Should().Equal(originalContent);
}
Expand Down Expand Up @@ -101,7 +101,7 @@ public void ThrowsDirectoryNotFoundExceptionOnCopyingAFile_WhenDestinationDirect

Action action = () => this.testee.Copy(SourceFile, DestinationFile);

action.ShouldThrow<DirectoryNotFoundException>();
action.Should().Throw<DirectoryNotFoundException>();
this.fileSystem.FileExists(DestinationFile)
.Should().BeFalse();
}
Expand All @@ -114,7 +114,7 @@ public void ThrowsDirectoryNotFoundExceptionOnCopyingAFileWithOverwriteFlag_When

Action action = () => this.testee.Copy(SourceFile, DestinationFile, true);

action.ShouldThrow<DirectoryNotFoundException>();
action.Should().Throw<DirectoryNotFoundException>();
this.fileSystem.FileExists(DestinationFile)
.Should().BeFalse();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void DoesNotOverwriteAFileOnCopyToByDefault()

Action action = () => this.testee.CopyTo(destinationPath);

action.ShouldThrow<IOException>();
action.Should().Throw<IOException>();
this.fileSystem.GetFile(destinationPath).Should().BeEquivalentTo(originalContent);
}

Expand All @@ -103,7 +103,7 @@ public void DoesNotOverwriteAFileOnCopyTo_WhenOverwriteFlagNotSet()

Action action = () => this.testee.CopyTo(destinationPath, false);

action.ShouldThrow<IOException>();
action.Should().Throw<IOException>();
this.fileSystem.GetFile(destinationPath).Should().BeEquivalentTo(originalContent);
}

Expand All @@ -114,7 +114,7 @@ public void ThrowsDirectoryNotFoundExceptionOnCopyTo_WhenDestinationDirectoryDoe

Action action = () => this.testee.CopyTo(destinationPath);

action.ShouldThrow<DirectoryNotFoundException>();
action.Should().Throw<DirectoryNotFoundException>();
this.fileSystem.FileExists(destinationPath)
.Should().BeFalse();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void EnsuresDirectoryForFilePathExists()

Action action = () => this.fileSystem.EnsureParentDirectoryExists(Path.Combine(directoryPath, "test.txt"));

action.ShouldNotThrow();
action.Should().NotThrow();
}

[Fact]
Expand All @@ -51,7 +51,7 @@ public void ThrowsDirectoryNotFoundException_WhenDirectoryOfFilePathDoesNotExist

Action action = () => this.fileSystem.EnsureParentDirectoryExists(Path.Combine(directoryPath, "butDifferent", "test.txt"));

action.ShouldThrow<DirectoryNotFoundException>();
action.Should().Throw<DirectoryNotFoundException>();
}
}
}
Loading

0 comments on commit c7ce60c

Please sign in to comment.