diff --git a/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md similarity index 100% rename from ISSUE_TEMPLATE.md rename to .github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md diff --git a/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from PULL_REQUEST_TEMPLATE.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..2d3aaf8 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,34 @@ +name: Build and Test + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +defaults: + run: + shell: pwsh + +jobs: + build-and-test: + name: build-and-test on ${{matrix.os}} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v2 + with: + dotnet-version: | + 3.1.x + 6.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build -p:ContinuousIntegrationBuild=True --no-restore --configuration Release + - name: Test + run: dotnet test --no-build --configuration Release --verbosity normal diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..52c54c7 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,75 @@ +name: Deploy + +on: + release: + types: [created] + +defaults: + run: + shell: pwsh + +env: + baseVersion: 1.0.0 + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v2 + with: + dotnet-version: | + 3.1.x + 6.x + - name: Restore dependencies + run: dotnet restore + - name: Set Version + run: | + echo "${{ github.ref }}" + if ("${{ github.ref }}".startsWith("refs/tags/v")) { + $tagVersion = "${{ github.ref }}".substring(11) + echo "buildVersion=$tagVersion.${{ github.run_number }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "nugetVersion=$tagVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "preRelease=false" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } else { + echo "buildVersion=${{ env.baseVersion }}.${{ github.run_number }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "nugetVersion=${{ env.baseVersion }}-ci${{ github.run_number }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } + - name: Build + run: dotnet build -p:Version=${{ env.buildVersion }} -p:ContinuousIntegrationBuild=True --no-restore --configuration Release + - name: Test + run: dotnet test --no-build --configuration Release --verbosity normal + - name: Pack + if: startsWith(github.ref, 'refs/tags/v') + run: dotnet pack -p:PackageVersion=${{ env.nugetVersion }} --configuration Release -o ${{env.DOTNET_ROOT}}/IntelliTect.UtilitiesPack --no-build + - name: Upload Artifacts + if: startsWith(github.ref, 'refs/tags/v') + uses: actions/upload-artifact@v2 + with: + name: NuGet + path: ${{env.DOTNET_ROOT}}/IntelliTect.UtilitiesPack + + deploy: + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + needs: build-and-test + environment: + name: 'Production' + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v2 + with: + name: NuGet + - name: Push NuGet + run: | + $tagVersion = "${{ github.ref }}".substring(11) + echo '::set-output name=TAG_VERSION::$tagVersion' + dotnet nuget push IntelliTect.Utilities.$tagVersion.nupkg --source https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate + id: tag-version + - name: Upload nupkg to Releases + uses: softprops/action-gh-release@v1 + with: + fail_on_unmatched_files: true + generate_release_notes: true + files: IntelliTect.Utilities.${{ steps.tag-version.outputs.TAG_VERSION }}.nupkg \ No newline at end of file diff --git a/IntelliTect.IntelliWait.Tests/BaseTest.cs b/IntelliTect.IntelliWait.Tests/BaseTest.cs deleted file mode 100644 index d5a97fb..0000000 --- a/IntelliTect.IntelliWait.Tests/BaseTest.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Diagnostics; - -namespace IntelliTect.IntelliWait.Tests -{ - public class BaseTest - { - public BaseTest() - { - Test = new FakeTestClass(); - } - - protected FakeTestClass Test { get; } - } -} diff --git a/IntelliTect.IntelliWait.Tests/ExpectedExceptionsTests.cs b/IntelliTect.IntelliWait.Tests/ExpectedExceptionsTests.cs deleted file mode 100644 index 2b2d330..0000000 --- a/IntelliTect.IntelliWait.Tests/ExpectedExceptionsTests.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System; -using System.Threading.Tasks; -using Xunit; - -namespace IntelliTect.IntelliWait.Tests -{ - public class ExpectedExceptionsTests : BaseTest - { - [Fact] - public async Task CheckActionsParamsForBaseTypeChecking() - { - AggregateException ae = await Assert.ThrowsAsync(() => Poll.UntilNoExceptions(Test.ThrowExceptionWithNoReturn, TimeSpan.FromSeconds(1), typeof(Exception))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(Exception)); - } - - [Fact] - public async Task CheckFuncParamsForBaseTypeChecking() - { - AggregateException ae = await Assert.ThrowsAsync(() => Poll.UntilNoExceptions(Test.ThrowExceptionWithReturn, TimeSpan.FromSeconds(1), typeof(Exception))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(Exception)); - } - - [Fact] - public async Task CheckActionParamsForMixedTypeChecking() - { - AggregateException ae = await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions(Test.ThrowExceptionWithNoReturn, TimeSpan.FromSeconds(1), typeof(Exception), typeof(NullReferenceException))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(Exception)); - // Verify that we only catch the actual exceptions thrown - Assert.DoesNotContain(ae.InnerExceptions, e => e.GetType() == typeof(NullReferenceException)); - } - - [Fact] - public async Task CheckFuncParamsForMixedTypeChecking() - { - AggregateException ae = await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions(Test.ThrowExceptionWithReturn, TimeSpan.FromSeconds(1), typeof(Exception), typeof(NullReferenceException))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(Exception)); - // Verify that we only catch the actual exceptions thrown - Assert.DoesNotContain(ae.InnerExceptions, e => e.GetType() == typeof(NullReferenceException)); - } - - [Fact] - public async Task CheckActionsParamsForOneDerivedTypeChecking() - { - AggregateException ae = await Assert.ThrowsAsync(() => Poll.UntilNoExceptions(() => Test.CheckExceptionsVoidReturn(2, 1), TimeSpan.FromSeconds(1), typeof(InvalidOperationException))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidOperationException)); - } - - [Fact] - public async Task CheckFuncParamsForOneDerivedTypeChecking() - { - AggregateException ae = await Assert.ThrowsAsync(() => Poll.UntilNoExceptions(() => Test.CheckExceptionsBoolReturn(2, 1), TimeSpan.FromSeconds(1), typeof(InvalidOperationException))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidOperationException)); - } - - [Fact] - public async Task CheckActionsGenericForOneDerivedTypeChecking() - { - AggregateException ae = await Assert.ThrowsAsync(() => Poll.UntilNoExceptions(() => Test.CheckExceptionsVoidReturn(2, 1), TimeSpan.FromSeconds(1))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidOperationException)); - } - - [Fact] - public async Task CheckFuncGenericForOneDerivedTypeChecking() - { - AggregateException ae = await Assert.ThrowsAsync(() => Poll.UntilNoExceptions(() => Test.CheckExceptionsBoolReturn(2, 1), TimeSpan.FromSeconds(1))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidOperationException)); - } - - [Fact] - public async Task CheckActionsGenericForTwoDerivedTypesChecking() - { - AggregateException ae = await Assert.ThrowsAsync(() => Poll.UntilNoExceptions(() => Test.CheckExceptionsVoidReturn(2, 2), TimeSpan.FromSeconds(1))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidOperationException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidProgramException)); - } - - [Fact] - public async Task CheckFuncGenericForTwoDerivedTypesChecking() - { - AggregateException ae = await Assert.ThrowsAsync(() => Poll.UntilNoExceptions(() => Test.CheckExceptionsBoolReturn(2, 2), TimeSpan.FromSeconds(1))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidOperationException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidProgramException)); - } - - [Fact] - public async Task CheckActionsGenericForThreeDerivedTypesChecking() - { - AggregateException ae = await Assert.ThrowsAsync(() => Poll.UntilNoExceptions(() => Test.CheckExceptionsVoidReturn(2, 3), TimeSpan.FromSeconds(1))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidOperationException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidProgramException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(IndexOutOfRangeException)); - } - - [Fact] - public async Task CheckFuncGenericForThreeDerivedTypesChecking() - { - AggregateException ae = await Assert.ThrowsAsync(() => Poll.UntilNoExceptions(() => Test.CheckExceptionsBoolReturn(2, 3), TimeSpan.FromSeconds(1))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidOperationException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidProgramException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(IndexOutOfRangeException)); - } - - [Fact] - public async Task CheckActionsGenericForFourDerivedTypesChecking() - { - AggregateException ae = await Assert.ThrowsAsync(() => - Poll.UntilNoExceptions(() => Test.CheckExceptionsVoidReturn(4, 4), TimeSpan.FromSeconds(3))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidOperationException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidProgramException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(IndexOutOfRangeException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(ArgumentNullException)); - } - - [Fact] - public async Task CheckFuncGenericForFourDerivedTypesChecking() - { - AggregateException ae = await Assert.ThrowsAsync(() => - Poll.UntilNoExceptions(() => Test.CheckExceptionsBoolReturn(4, 4), TimeSpan.FromSeconds(3))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidOperationException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidProgramException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(IndexOutOfRangeException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(ArgumentNullException)); - } - - [Fact] - public async Task CheckActionsGenericForFiveDerivedTypesChecking() - { - AggregateException ae = await Assert.ThrowsAsync(() => - Poll.UntilNoExceptions(() => Test.CheckExceptionsVoidReturn(5, 5), TimeSpan.FromSeconds(4))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidOperationException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidProgramException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(IndexOutOfRangeException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(ArgumentNullException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(FieldAccessException)); - } - - [Fact] - public async Task CheckFuncGenericForFiveDerivedTypesChecking() - { - AggregateException ae = await Assert.ThrowsAsync(() => - Poll.UntilNoExceptions(() => Test.CheckExceptionsBoolReturn(5, 5), TimeSpan.FromSeconds(4))); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidOperationException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(InvalidProgramException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(IndexOutOfRangeException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(ArgumentNullException)); - Assert.Contains(ae.InnerExceptions, e => e.GetType() == typeof(FieldAccessException)); - } - } -} diff --git a/IntelliTect.IntelliWait.Tests/FakeTestClass.cs b/IntelliTect.IntelliWait.Tests/FakeTestClass.cs deleted file mode 100644 index f0ad559..0000000 --- a/IntelliTect.IntelliWait.Tests/FakeTestClass.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Diagnostics; - -namespace IntelliTect.IntelliWait.Tests -{ - public class FakeTestClass - { - public void ThrowExceptionWithNoReturn() - { - throw new Exception(); - } - - public bool ThrowExceptionWithReturn() - { - throw new Exception(); - } - - public void ThrowNullRefExceptionWithNoReturn() - { - throw new NullReferenceException(); - } - - public bool ThrowNullRefExceptionWithReturn() - { - throw new NullReferenceException(); - } - - public void CheckExceptionsVoidReturn(int secondsToFail = 1, int numberOfDifferentExceptions = 1) - { - ThrowExceptions(secondsToFail, numberOfDifferentExceptions); - } - - public bool CheckExceptionsBoolReturn(int secondsToFail = 1, int numberOfDifferentExceptions = 1) - { - ThrowExceptions(secondsToFail, numberOfDifferentExceptions); - return true; - } - - // Find a better way to do this to better facilitate test parallelization - private void ThrowExceptions(int secondsToFail, int numberOfExceptions) - { - if (_Timeout == TimeSpan.MinValue) - { - _Timeout = TimeSpan.FromSeconds(secondsToFail); - _Sw.Start(); - } - - while (_Sw.Elapsed <= _Timeout) - { - _Attempts++; - if (_Attempts > numberOfExceptions) - { - _Attempts = 1; - } - switch (_Attempts) - { - case 1: - throw new InvalidOperationException(); - case 2: - throw new InvalidProgramException(); - case 3: - throw new IndexOutOfRangeException(); - case 4: - throw new ArgumentNullException(); - case 5: - throw new FieldAccessException(); - default: - throw new ArgumentException(); - } - } - } - - private int _Attempts = 0; - private TimeSpan _Timeout = TimeSpan.MinValue; - private Stopwatch _Sw = new Stopwatch(); - } -} \ No newline at end of file diff --git a/IntelliTect.IntelliWait.Tests/IntelliTect.IntelliWait.Tests.csproj b/IntelliTect.IntelliWait.Tests/IntelliTect.IntelliWait.Tests.csproj deleted file mode 100644 index adf0d93..0000000 --- a/IntelliTect.IntelliWait.Tests/IntelliTect.IntelliWait.Tests.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - netcoreapp2.0 - - false - - - - - - - all - runtime; build; native; contentfiles; analyzers - - - - - - - - - diff --git a/IntelliTect.IntelliWait.Tests/NoExceptionThrownTests.cs b/IntelliTect.IntelliWait.Tests/NoExceptionThrownTests.cs deleted file mode 100644 index 4ba611f..0000000 --- a/IntelliTect.IntelliWait.Tests/NoExceptionThrownTests.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Threading.Tasks; -using Xunit; - -namespace IntelliTect.IntelliWait.Tests -{ - public class NoExceptionThrownTests : BaseTest - { - [Fact] - public async Task CheckActionParamsForExpectedExpectionDoesNotThrow() - { - await Poll.UntilNoExceptions(() => Test.CheckExceptionsVoidReturn(1, 1), TimeSpan.FromSeconds(2), typeof(InvalidOperationException)); - } - - [Fact] - public async Task CheckFuncParamsForExpectedExpectionDoesNotThrow() - { - await Poll.UntilNoExceptions(() => Test.CheckExceptionsBoolReturn(1, 1), TimeSpan.FromSeconds(2), typeof(InvalidOperationException)); - } - - [Fact] - public async Task CheckActionsGenericForOneExpectedExceptionDoesNotThrow() - { - await Poll.UntilNoExceptions(() => Test.CheckExceptionsVoidReturn(1, 1), TimeSpan.FromSeconds(2)); - } - - [Fact] - public async Task CheckFuncGenericForOneExpectedExceptionDoesNotThrow() - { - await Poll.UntilNoExceptions(() => Test.CheckExceptionsBoolReturn(1, 1), TimeSpan.FromSeconds(2)); - } - - [Fact] - public async Task CheckActionsGenericForTwoExpectedExceptiosnDoesNotThrow() - { - await Poll.UntilNoExceptions(() => Test.CheckExceptionsVoidReturn(1, 2), TimeSpan.FromSeconds(2)); - } - - [Fact] - public async Task CheckFuncGenericForTwoExpectedExceptionsDoesNotThrow() - { - await Poll.UntilNoExceptions(() => Test.CheckExceptionsBoolReturn(1, 2), TimeSpan.FromSeconds(2)); - } - - [Fact] - public async Task CheckActionsGenericForThreeExpectedExceptiosnDoesNotThrow() - { - await Poll.UntilNoExceptions(() => Test.CheckExceptionsVoidReturn(1, 3), TimeSpan.FromSeconds(2)); - } - - [Fact] - public async Task CheckFuncGenericForThreeExpectedExceptionsDoesNotThrow() - { - await Poll.UntilNoExceptions(() => Test.CheckExceptionsBoolReturn(1, 3), TimeSpan.FromSeconds(2)); - } - - [Fact] - public async Task CheckActionsGenericForFourExpectedExceptiosnDoesNotThrow() - { - await Poll.UntilNoExceptions(() => Test.CheckExceptionsVoidReturn(1, 4), TimeSpan.FromSeconds(2)); - } - - [Fact] - public async Task CheckFuncGenericForFourExpectedExceptionsDoesNotThrow() - { - await Poll.UntilNoExceptions(() => Test.CheckExceptionsBoolReturn(1, 4), TimeSpan.FromSeconds(2)); - } - - [Fact] - public async Task CheckActionsGenericForFiveExpectedExceptiosnDoesNotThrow() - { - await Poll.UntilNoExceptions(() => Test.CheckExceptionsVoidReturn(1, 5), TimeSpan.FromSeconds(2)); - } - - [Fact] - public async Task CheckFuncGenericForFiveExpectedExceptionsDoesNotThrow() - { - await Poll.UntilNoExceptions(() => Test.CheckExceptionsBoolReturn(1, 5), TimeSpan.FromSeconds(2)); - } - } -} diff --git a/IntelliTect.IntelliWait.Tests/TypeCheckingTests.cs b/IntelliTect.IntelliWait.Tests/TypeCheckingTests.cs deleted file mode 100644 index 1d87293..0000000 --- a/IntelliTect.IntelliWait.Tests/TypeCheckingTests.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using System.Threading.Tasks; -using Xunit; - -namespace IntelliTect.IntelliWait.Tests -{ - public class TypeCheckingTests : BaseTest - { - [Fact] - public async Task CheckActionParamsForInvalidTypeChecking() - { - Exception ex = await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions(Test.ThrowExceptionWithNoReturn, TimeSpan.FromSeconds(1), typeof(string))); - Assert.Equal(ExceptionMessage, ex.Message); - } - - [Fact] - public async Task CheckFuncParamsForInvalidTypeChecking() - { - Exception ex = await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions(Test.ThrowExceptionWithReturn, TimeSpan.FromSeconds(1), typeof(string))); - Assert.Equal(ExceptionMessage, ex.Message); - } - - [Fact] - public async Task CheckActionParamsForMixedInvalidTypeChecking() - { - Exception ex = await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions(Test.ThrowNullRefExceptionWithNoReturn, TimeSpan.FromSeconds(1), typeof(Exception), typeof(string))); - Assert.Equal(ExceptionMessage, ex.Message); - } - - [Fact] - public async Task CheckFuncParamsForMixedInvalidTypeChecking() - { - Exception ex = await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions(Test.ThrowNullRefExceptionWithReturn, TimeSpan.FromSeconds(1), typeof(string), typeof(NullReferenceException))); - Assert.Equal(ExceptionMessage, ex.Message); - } - - private const string ExceptionMessage = "Invalid type passed into exceptionsToIgnore parameter. Must be of type Exception."; - } -} diff --git a/IntelliTect.IntelliWait.Tests/UnExpectedExceptionsTests.cs b/IntelliTect.IntelliWait.Tests/UnExpectedExceptionsTests.cs deleted file mode 100644 index 7a1cfc5..0000000 --- a/IntelliTect.IntelliWait.Tests/UnExpectedExceptionsTests.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Threading.Tasks; -using Xunit; - -namespace IntelliTect.IntelliWait.Tests -{ - public class UnExpectedExceptionsTests : BaseTest - { - [Fact] - public async Task CheckActionParamsWithNoExceptionArgumentThrowsException() - { - await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions( - () => Test.CheckExceptionsVoidReturn(1, 1), TimeSpan.FromSeconds(2))); - } - - [Fact] - public async Task CheckFuncParamsForNoExceptionArgumentThrowsException() - { - await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions( - () => Test.CheckExceptionsBoolReturn(1, 1), TimeSpan.FromSeconds(2))); - } - - [Fact] - public async Task CheckActionParamsForUnExpectedExpectionThrows() - { - await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions( - () => Test.CheckExceptionsVoidReturn(1, 1), TimeSpan.FromSeconds(2), typeof(NullReferenceException))); - } - - [Fact] - public async Task CheckFuncParamsForUnExpectedExpectionThrows() - { - await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions( - () => Test.CheckExceptionsBoolReturn(1, 1), TimeSpan.FromSeconds(2), typeof(NullReferenceException))); - } - - [Fact] - public async Task CheckActionGenericForOneUnExpectedExpectionThrows() - { - await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions( - () => Test.CheckExceptionsVoidReturn(1, 1), TimeSpan.FromSeconds(2))); - } - - [Fact] - public async Task CheckFuncGenericForOneUnExpectedExpectionThrows() - { - await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions( - () => Test.CheckExceptionsBoolReturn(1, 1), TimeSpan.FromSeconds(2))); - } - - [Fact] - public async Task CheckActionGenericForTwoUnExpectedExpectionsThrows() - { - await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions( - () => Test.CheckExceptionsVoidReturn(1, 2), TimeSpan.FromSeconds(2))); - } - - [Fact] - public async Task CheckFuncGenericForTwoUnExpectedExpectionsThrows() - { - await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions( - () => Test.CheckExceptionsBoolReturn(1, 2), TimeSpan.FromSeconds(2))); - } - - [Fact] - public async Task CheckActionGenericForThreeUnExpectedExpectionsThrows() - { - await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions( - () => Test.CheckExceptionsVoidReturn(1, 3), TimeSpan.FromSeconds(2))); - } - - [Fact] - public async Task CheckActionGenericForFourUnExpectedExpectionsThrows() - { - await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions( - () => Test.CheckExceptionsVoidReturn(1, 4), TimeSpan.FromSeconds(2))); - } - - [Fact] - public async Task CheckFuncGenericForFourUnExpectedExpectionsThrows() - { - await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions( - () => Test.CheckExceptionsBoolReturn(1, 4), TimeSpan.FromSeconds(2))); - } - - [Fact] - public async Task CheckActionGenericForFiveUnExpectedExpectionsThrows() - { - await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions( - () => Test.CheckExceptionsVoidReturn(1, 5), TimeSpan.FromSeconds(2))); - } - - [Fact] - public async Task CheckFuncGenericForFiveUnExpectedExpectionsThrows() - { - await Assert.ThrowsAsync( - () => Poll.UntilNoExceptions( - () => Test.CheckExceptionsBoolReturn(1, 5), TimeSpan.FromSeconds(2))); - } - } -} diff --git a/IntelliTect.IntelliWait/CustomDictionary.xml b/IntelliTect.IntelliWait/CustomDictionary.xml deleted file mode 100644 index e611429..0000000 --- a/IntelliTect.IntelliWait/CustomDictionary.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - Intelli - Tect - - - \ No newline at end of file diff --git a/IntelliTect.IntelliWait/IntelliTect.IntelliWait.csproj b/IntelliTect.IntelliWait/IntelliTect.IntelliWait.csproj deleted file mode 100644 index a694afa..0000000 --- a/IntelliTect.IntelliWait/IntelliTect.IntelliWait.csproj +++ /dev/null @@ -1,43 +0,0 @@ - - - netstandard2.0 - true - true - IntelliTect-Nuget; Mike Curn - IntelliTect - Set of methods to facilitate waiting a certain amount of time for a delegate to evaluate, while ignoring certain exceptions while attempting to evaluate, and throwing after a specified time limit (or throwing immediately if an unexpected exception is encountered) - - Copyright © IntelliTect 2019 - https://github.com/IntelliTect/IntelliTect - https://github.com/IntelliTect/IntelliTect - Git - ui test, automated test, testing, api test, web test, integration test, await, async - Obsoleting in favor of Polly - IntelliTect.IntelliWait - 1.2.1 - MIT - en - - - - - - - all - runtime; build; native; contentfiles; analyzers - - - - - True - True - Resources.resx - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - diff --git a/IntelliTect.IntelliWait/Poll.cs b/IntelliTect.IntelliWait/Poll.cs deleted file mode 100644 index a4ad565..0000000 --- a/IntelliTect.IntelliWait/Poll.cs +++ /dev/null @@ -1,248 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; -using IntelliTect.IntelliWait.Properties; - -namespace IntelliTect.IntelliWait -{ - [Obsolete("Deprecating in favor of Polly, which is a more robust and flexible polling library: https://github.com/App-vNext/Polly")] - public static class Poll - { - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// Return type of the function to evaluate - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// A list of exceptions to ignore when attempting to evaluate the function - /// An async task that can return a value of type TResult - public static Task UntilNoExceptions(Func func, TimeSpan timeToWait, params Type[] exceptionsToIgnore) - { - VerifyAllExceptionTypes(exceptionsToIgnore); - return ExecutePollingFunction(func, timeToWait, exceptionsToIgnore); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// A list of exceptions to ignore when attempting to evaluate the function - /// An async task for the operation - public static Task UntilNoExceptions(Action action, TimeSpan timeToWait, params Type[] exceptionsToIgnore) - { - VerifyAllExceptionTypes(exceptionsToIgnore); - return ExecutePollingFunction(action, timeToWait, exceptionsToIgnore); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// Return type of the function to evaluate - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task that can return a value of type TResult - public static Task UntilNoExceptions(Func func, TimeSpan timeToWait) - where TException : Exception - { - return ExecutePollingFunction(func, timeToWait, typeof(TException)); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task for the operation - public static Task UntilNoExceptions(Action action, TimeSpan timeToWait) - where TException : Exception - { - return ExecutePollingFunction(action, timeToWait, typeof(TException)); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// Return type of the function to evaluate - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task that can return a value of type TResult - public static Task UntilNoExceptions(Func func, TimeSpan timeToWait) - where TException1 : Exception - where TException2 : Exception - { - return ExecutePollingFunction(func, timeToWait, typeof(TException1), typeof(TException2)); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task for the operation - public static Task UntilNoExceptions(Action action, TimeSpan timeToWait) - where TException1 : Exception - where TException2 : Exception - { - return ExecutePollingFunction(action, timeToWait, typeof(TException1), typeof(TException2)); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// Return type of the function to evaluate - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task that can return a value of type TResult - public static Task UntilNoExceptions(Func func, TimeSpan timeToWait) - where TException1 : Exception - where TException2 : Exception - where TException3 : Exception - { - return ExecutePollingFunction(func, timeToWait, typeof(TException1), typeof(TException2), typeof(TException3)); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task for the operation - public static Task UntilNoExceptions(Action action, TimeSpan timeToWait) - where TException1 : Exception - where TException2 : Exception - where TException3 : Exception - { - return ExecutePollingFunction(action, timeToWait, typeof(TException1), typeof(TException2), typeof(TException3)); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// Return type of the function to evaluate - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task that can return a value of type TResult - public static Task UntilNoExceptions(Func func, TimeSpan timeToWait) - where TException1 : Exception - where TException2 : Exception - where TException3 : Exception - where TException4 : Exception - { - return ExecutePollingFunction(func, timeToWait, typeof(TException1), typeof(TException2), typeof(TException3), typeof(TException4)); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task for the operation - public static Task UntilNoExceptions(Action action, TimeSpan timeToWait) - where TException1 : Exception - where TException2 : Exception - where TException3 : Exception - where TException4 : Exception - { - return ExecutePollingFunction(action, timeToWait, typeof(TException1), typeof(TException2), typeof(TException3), typeof(TException4)); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// Return type of the function to evaluate - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task that can return a value of type TResult - public static Task UntilNoExceptions(Func func, TimeSpan timeToWait) - where TException1 : Exception - where TException2 : Exception - where TException3 : Exception - where TException4 : Exception - where TException5 : Exception - { - return ExecutePollingFunction(func, timeToWait, typeof(TException1), typeof(TException2), typeof(TException3), typeof(TException4), typeof(TException5)); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task for the operation - public static Task UntilNoExceptions(Action action, TimeSpan timeToWait) - where TException1 : Exception - where TException2 : Exception - where TException3 : Exception - where TException4 : Exception - where TException5 : Exception - { - return ExecutePollingFunction(action, timeToWait, typeof(TException1), typeof(TException2), typeof(TException3), typeof(TException4), typeof(TException5)); - } - - private static Task ExecutePollingFunction(Action actionToWaitForComplete, TimeSpan timeToWait, params Type[] types) - { - return ExecutePollingFunction(() => { actionToWaitForComplete(); return true; }, timeToWait, types); - } - - private static async Task ExecutePollingFunction(Func actionToWaitForComplete, TimeSpan timeToWait, params Type[] types) - { - Stopwatch sw = new Stopwatch(); - sw.Start(); - List exceptions = new List(); - do - { - try - { - return actionToWaitForComplete(); - } - catch (Exception ex) when (types.Contains(ex.GetType())) - { - exceptions.Add(ex); - } - await Task.Delay(250).ConfigureAwait(false); - } while (sw.Elapsed < timeToWait); - throw new AggregateException(exceptions); - } - - private static void VerifyAllExceptionTypes(params Type[] exes) - { - if (!exes.All(e => e.IsSubclassOf(typeof(Exception)) || e == typeof(Exception))) - { - throw new ArgumentException(Resources.VerifyAllExceptionTypes_ArgumentException); - } - } - } -} diff --git a/IntelliTect.IntelliWait/Properties/Resources.Designer.cs b/IntelliTect.IntelliWait/Properties/Resources.Designer.cs deleted file mode 100644 index 658d69a..0000000 --- a/IntelliTect.IntelliWait/Properties/Resources.Designer.cs +++ /dev/null @@ -1,72 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace IntelliTect.IntelliWait.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("IntelliTect.IntelliWait.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to Invalid type passed into exceptionsToIgnore parameter. Must be of type Exception.. - /// - internal static string VerifyAllExceptionTypes_ArgumentException { - get { - return ResourceManager.GetString("VerifyAllExceptionTypes_ArgumentException", resourceCulture); - } - } - } -} diff --git a/IntelliTect.IntelliWait/Properties/Resources.resx b/IntelliTect.IntelliWait/Properties/Resources.resx deleted file mode 100644 index 66c78df..0000000 --- a/IntelliTect.IntelliWait/Properties/Resources.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Invalid type passed into exceptionsToIgnore parameter. Must be of type Exception. - - \ No newline at end of file diff --git a/IntelliTect.IntelliWait/Wait.cs b/IntelliTect.IntelliWait/Wait.cs deleted file mode 100644 index d369bf6..0000000 --- a/IntelliTect.IntelliWait/Wait.cs +++ /dev/null @@ -1,179 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; - -namespace IntelliTect.IntelliWait -{ - [Obsolete("Deprecating in favor of Polly, which is a more robust and flexible polling library: https://github.com/App-vNext/Polly")] - public static class Wait - { - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// Return type of the function to evaluate - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// A list of exceptions to ignore when attempting to evaluate the function - /// An async task that can return a value of type TResult - [Obsolete("Deprecating Wait.Until() naming convention in favor of more accurate and descriptive Poll.UntilNoExceptions naming")] - public static Task Until(Func func, TimeSpan timeToWait, params Type[] exceptionsToIgnore) - { - return Poll.UntilNoExceptions(func, timeToWait, exceptionsToIgnore); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// A list of exceptions to ignore when attempting to evaluate the function - /// An async task for the operation - [Obsolete("Deprecating Wait.Until() naming convention in favor of more accurate and descriptive Poll.UntilNoExceptions naming")] - public static Task Until(Action action, TimeSpan timeToWait, params Type[] exceptionsToIgnore) - { - return Poll.UntilNoExceptions(action, timeToWait, exceptionsToIgnore); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// Return type of the function to evaluate - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task that can return a value of type TResult - [Obsolete("Deprecating Wait.Until() naming convention in favor of more accurate and descriptive Poll.UntilNoExceptions naming")] - public static Task Until(Func func, TimeSpan timeToWait) - where TException : Exception - { - return Poll.UntilNoExceptions(func, timeToWait); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task for the operation - [Obsolete("Deprecating Wait.Until() naming convention in favor of more accurate and descriptive Poll.UntilNoExceptions naming")] - public static Task Until(Action action, TimeSpan timeToWait) - where TException : Exception - { - return Poll.UntilNoExceptions(action, timeToWait); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// Return type of the function to evaluate - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task that can return a value of type TResult - [Obsolete("Deprecating Wait.Until() naming convention in favor of more accurate and descriptive Poll.UntilNoExceptions naming")] - public static Task Until(Func func, TimeSpan timeToWait) - where TException1 : Exception - where TException2 : Exception - { - return Poll.UntilNoExceptions(func, timeToWait); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task for the operation - [Obsolete("Deprecating Wait.Until() naming convention in favor of more accurate and descriptive Poll.UntilNoExceptions naming")] - public static Task Until(Action action, TimeSpan timeToWait) - where TException1 : Exception - where TException2 : Exception - { - return Poll.UntilNoExceptions(action, timeToWait); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// Return type of the function to evaluate - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task that can return a value of type TResult - [Obsolete("Deprecating Wait.Until() naming convention in favor of more accurate and descriptive Poll.UntilNoExceptions naming")] - public static Task Until(Func func, TimeSpan timeToWait) - where TException1 : Exception - where TException2 : Exception - where TException3 : Exception - { - return Poll.UntilNoExceptions(func, timeToWait); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task for the operation - [Obsolete("Deprecating Wait.Until() naming convention in favor of more accurate and descriptive Poll.UntilNoExceptions naming")] - public static Task Until(Action action, TimeSpan timeToWait) - where TException1 : Exception - where TException2 : Exception - where TException3 : Exception - { - return Poll.UntilNoExceptions(action, timeToWait); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// Return type of the function to evaluate - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task that can return a value of type TResult - [Obsolete("Deprecating Wait.Until() naming convention in favor of more accurate and descriptive Poll.UntilNoExceptions naming")] - public static Task Until(Func func, TimeSpan timeToWait) - where TException1 : Exception - where TException2 : Exception - where TException3 : Exception - where TException4 : Exception - { - return Poll.UntilNoExceptions(func, timeToWait); - } - - /// - /// Repeatedly checks for a condition with void return type until it is satisifed or a timeout is reached - /// - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// An exception type to ignore when attempting to evaluate the function - /// Function to check for valid evaluation - /// Time to try evaluating the given function until an exception is thrown - /// An async task for the operation - [Obsolete("Deprecating Wait.Until() naming convention in favor of more accurate and descriptive Poll.UntilNoExceptions naming")] - public static Task Until(Action action, TimeSpan timeToWait) - where TException1 : Exception - where TException2 : Exception - where TException3 : Exception - where TException4 : Exception - { - return Poll.UntilNoExceptions(action, timeToWait); - } - } -} diff --git a/IntelliTect.Utilities.Tests/IntelliTect.Utilities.Tests.csproj b/IntelliTect.Utilities.Tests/IntelliTect.Utilities.Tests.csproj index 63fd1be..598bec0 100644 --- a/IntelliTect.Utilities.Tests/IntelliTect.Utilities.Tests.csproj +++ b/IntelliTect.Utilities.Tests/IntelliTect.Utilities.Tests.csproj @@ -1,18 +1,16 @@  - netcoreapp2.0 + netcoreapp3.1 false - - - - - - + + + + all runtime; build; native; contentfiles; analyzers diff --git a/IntelliTect.Utilities/IntelliTect.Utilities.csproj b/IntelliTect.Utilities/IntelliTect.Utilities.csproj index 060a2f0..4a22492 100644 --- a/IntelliTect.Utilities/IntelliTect.Utilities.csproj +++ b/IntelliTect.Utilities/IntelliTect.Utilities.csproj @@ -1,18 +1,23 @@ - netstandard2.0 + netstandard2.1 + Library true - true + true + snupkg + true IntelliTect-Nuget IntelliTect A utility library for IntelliTect - https://github.com/IntelliTect/IntelliTect/blob/main/LICENSE Copyright © IntelliTect 2019 https://github.com/IntelliTect/IntelliTect https://github.com/IntelliTect/IntelliTect Git IntelliTect Utilities - Update deps and fix CA warnings-as-errors. + MIT + git + true + true true en 1.0.1 @@ -21,9 +26,9 @@ - + all - runtime; build; native; contentfiles; analyzers + runtime; build; native; contentfiles; analyzers; buildtransitive \ No newline at end of file diff --git a/IntelliTect.Utilities/Security/ClaimsPrincipalExtensions.cs b/IntelliTect.Utilities/Security/ClaimsPrincipalExtensions.cs index c17b502..de4766c 100644 --- a/IntelliTect.Utilities/Security/ClaimsPrincipalExtensions.cs +++ b/IntelliTect.Utilities/Security/ClaimsPrincipalExtensions.cs @@ -5,6 +5,9 @@ namespace IntelliTect.Utilities.Security { + /// + /// Gets information from a + /// public static class ClaimsPrincipalExtensions { /// diff --git a/IntelliTect.sln b/IntelliTect.sln index 0229ece..eb0a66e 100644 --- a/IntelliTect.sln +++ b/IntelliTect.sln @@ -1,19 +1,17 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26730.15 +# Visual Studio Version 17 +VisualStudioVersion = 17.3.32825.248 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.Utilities", "IntelliTect.Utilities\IntelliTect.Utilities.csproj", "{4AEDF7B5-8FD1-4361-B230-173646A0D20C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.Utilities.Tests", "IntelliTect.Utilities.Tests\IntelliTect.Utilities.Tests.csproj", "{B0281AA3-FAED-4A2C-8C5A-C2F3DC39511A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.IntelliWait", "IntelliTect.IntelliWait\IntelliTect.IntelliWait.csproj", "{C38B5217-6221-4D72-B264-CD7FF3D201BC}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntelliTect.IntelliWait.Tests", "IntelliTect.IntelliWait.Tests\IntelliTect.IntelliWait.Tests.csproj", "{174B4C67-DEFA-4387-A947-52395E4C79A5}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7FB66610-EB11-460E-8CC8-F49044F452D0}" ProjectSection(SolutionItems) = preProject appveyor.yml = appveyor.yml + .github\workflows\build-and-test.yml = .github\workflows\build-and-test.yml + .github\workflows\deploy.yml = .github\workflows\deploy.yml README.md = README.md EndProjectSection EndProject @@ -31,14 +29,6 @@ Global {B0281AA3-FAED-4A2C-8C5A-C2F3DC39511A}.Debug|Any CPU.Build.0 = Debug|Any CPU {B0281AA3-FAED-4A2C-8C5A-C2F3DC39511A}.Release|Any CPU.ActiveCfg = Release|Any CPU {B0281AA3-FAED-4A2C-8C5A-C2F3DC39511A}.Release|Any CPU.Build.0 = Release|Any CPU - {C38B5217-6221-4D72-B264-CD7FF3D201BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C38B5217-6221-4D72-B264-CD7FF3D201BC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C38B5217-6221-4D72-B264-CD7FF3D201BC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C38B5217-6221-4D72-B264-CD7FF3D201BC}.Release|Any CPU.Build.0 = Release|Any CPU - {174B4C67-DEFA-4387-A947-52395E4C79A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {174B4C67-DEFA-4387-A947-52395E4C79A5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {174B4C67-DEFA-4387-A947-52395E4C79A5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {174B4C67-DEFA-4387-A947-52395E4C79A5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/README.md b/README.md index dcbfdeb..0593985 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,14 @@ -# IntelliTect Open-Source Libraries +# [IntelliTect.Utilities](https://www.nuget.org/packages/IntelliTect.Utilities/): [![NuGet](https://img.shields.io/nuget/v/IntelliTect.Utilities.svg)](https://www.nuget.org/packages/IntelliTect.Utilities/) -[![Build status](https://ci.appveyor.com/api/projects/status/d69509l4p7gyb77j?svg=true)](https://ci.appveyor.com/project/IntelliTect/intellitect) +## Namespaces within this library -[![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/IntelliTect/home) - -Libraries of useful C# things, focused on shipping Nuget packages. - -Libraries -========= -### [IntelliTect.Utilities](https://www.nuget.org/packages/IntelliTect.Utilities/): [![NuGet](https://img.shields.io/nuget/v/IntelliTect.Utilities.svg)](https://www.nuget.org/packages/IntelliTect.Utilities/) - -### Namespaces within this library: -* IntelliTect.Utilities - - AssemblyInfo: Gets an assembly's linker date/time. +* IntelliTect.Utilities + * AssemblyInfo: Gets an assembly's linker date/time as shown in [IntelliTect's Blog](https://intellitect.com/blog/displaying-deploymentbuild-date-web-pages/) * IntelliTect.Utilities.Security - - ClaimsPrincipalExtensions: Extention methods to get a user ID and roles. - -### [IntelliTect.IntelliWait](https://www.nuget.org/packages/IntelliTect.IntelliWait/): [![NuGet](https://img.shields.io/nuget/v/IntelliTect.IntelliWait.svg)](https://www.nuget.org/packages/IntelliTect.IntelliWait/) - -### Namespaces within this library: + * ClaimsPrincipalExtensions: Extention methods to get a user ID and roles. -* IntelliTect.IntelliWait - - Wait: Set of methods to facilitate waiting a certain amount of time for a delegate to evaluate, while - ignoring certain exceptions while attempting to evaluate, and throwing after a specified time limit - (or throwing immediately if an unexpected exception is encountered). +## Contributing -Contributing -============ +------------ See the CONTRIBUTING.md file [here](https://raw.githubusercontent.com/IntelliTect/IntelliTect/main/CONTRIBUTING.md). diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 3f9f935..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,37 +0,0 @@ -version: 1.0.{build} -pull_requests: - do_not_increment_build_number: true -branches: - only: - - release - - main -skip_branch_with_pr: true -image: Visual Studio 2017 -assembly_info: - patch: true - file: '**\AssemblyInfo.*' - assembly_version: '{version}' - assembly_file_version: '{version}' - assembly_informational_version: '{version}' -dotnet_csproj: - patch: true - file: '**\*.csproj' - version: '{version}' - package_version: '{version}' - assembly_version: '{version}' - file_version: '{version}' - informational_version: '{version}' -before_build: -- cmd: dotnet restore -build: - publish_nuget: true - publish_nuget_symbols: true - include_nuget_references: true - verbosity: minimal -deploy: -- provider: NuGet - api_key: - secure: ViQUgBR04fO//b45zYHRvlnQI/PRjxmhC7ur0opzxuQCDO/ejXnN6ZiSri1hbgoU - skip_symbols: true - on: - branch: release \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 125873e..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml - -trigger: -- main - -variables: - IntelliTect.Utilities.Version: 1.0.15 - IntelliTect.IntelliWait.Version: 1.2.1 - -pool: - vmImage: 'ubuntu-latest' - -steps: -- task: DotNetCoreCLI@2 - inputs: - command: 'restore' - projects: '**/*.sln' - feedsToUse: 'select' -- task: DotNetCoreCLI@2 - inputs: - command: 'build' - projects: '**/*.sln' -- task: DotNetCoreCLI@2 - inputs: - command: 'test' - projects: '**/*.Tests.csproj' -- task: PowerShell@2 - inputs: - targetType: 'inline' - script: | - Get-ChildItem "IntelliTect.*" -Directory -Recurse -Exclude "*.Tests" | ForEach-Object { - Push-Location $_ - Write-Output "Directory changed to - $pwd" - $currentDirectoryFileName = Split-Path -Path $pwd -Leaf -Resolve - $qualifiedVersion = "$currentDirectoryFileName.Version".ToUpper().Replace(".", "_") - $parsedVersion = (get-item env:$qualifiedVersion).Value - Write-Output "Found version $qualifiedVersion - $parsedVersion" - dotnet pack -p:Version=$parsedVersion-ci$(Build.BuildId) -o $(Build.ArtifactStagingDirectory) - } - Pop-Location - pwsh: true -- task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: '$(Build.ArtifactStagingDirectory)' - ArtifactName: 'NuGets' - publishLocation: 'Container'