diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d2b9b45..ca33150 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,17 +16,18 @@ trigger: - '*' pool: - vmImage: 'windows-2019' + vmImage: 'windows-2022' stages: - stage: Build jobs: - job: steps: - - task: GitVersion@5 + - task: gitversion/setup@0 inputs: - runtime: 'core' - configFilePath: 'GitVersion.yml' - additionalArguments: '/output json' + versionSpec: '5.x' + - task: gitversion/execute@0 + inputs: + additionalArguments: '/output json' - task: DotNetCoreCLI@2 inputs: command: 'build' diff --git a/src/AssemblyFixture.csproj b/src/AssemblyFixture.csproj index 7fd4173..23f02cf 100644 --- a/src/AssemblyFixture.csproj +++ b/src/AssemblyFixture.csproj @@ -1,7 +1,7 @@  - net452;netstandard2.1;netstandard2.0 + net452;netstandard2.1;netstandard2.0;net5.0;net6.0 0.1.0 kzu, J.D. Cain diff --git a/test/AssemblyFixture.Tests.csproj b/test/AssemblyFixture.Tests.csproj index b0b8fd9..8437e40 100644 --- a/test/AssemblyFixture.Tests.csproj +++ b/test/AssemblyFixture.Tests.csproj @@ -1,7 +1,7 @@  - net472;netcoreapp3.0 + net472;netcoreapp3.0;net5.0;net6.0 diff --git a/test/Samples.cs b/test/Samples.cs index f4eb5da..5334c0a 100644 --- a/test/Samples.cs +++ b/test/Samples.cs @@ -1,95 +1,94 @@ -using System; -using Xunit; +using System; +using Xunit; using Xunit.Abstractions; -using Xunit.Extensions.AssemblyFixture; - -[assembly: TestFramework(AssemblyFixtureFramework.TypeName, AssemblyFixtureFramework.AssemblyName)] -namespace AssemblyFixture.Tests -{ - public class Sample1 : IAssemblyFixture - { - MyAssemblyFixture fixture; - - // Fixtures are injectable into the test classes, just like with class and collection fixtures - public Sample1(MyAssemblyFixture fixture) - { - this.fixture = fixture; - } - - [Fact] - public void EnsureSingleton() - { - Assert.Equal(1, MyAssemblyFixture.InstantiationCount); - } - } - - public class Sample2 : IAssemblyFixture - { - MyAssemblyFixture fixture; - - public Sample2(MyAssemblyFixture fixture) - { - this.fixture = fixture; - } - - [Fact] - public void EnsureSingleton() - { - Assert.Equal(1, MyAssemblyFixture.InstantiationCount); - } - } - - public class Sample3 : IAssemblyFixture - { - MyAssemblyFixtureWithMessageSink fixture; - - public Sample3(MyAssemblyFixtureWithMessageSink fixture) - { - this.fixture = fixture; - } - - [Fact] - public void EnsureThatHaveIMessageSink() - { - Assert.NotNull(fixture.MessageSink); - } - } - - public class MyAssemblyFixture : IDisposable - { - public static int InstantiationCount; - - public MyAssemblyFixture() - { - InstantiationCount++; - } - - public void Dispose() - { - // Uncomment this and it will surface as an assembly cleanup failure - //throw new DivideByZeroException(); - //InstantiationCount = 0; - } - } - - public class MyAssemblyFixtureWithMessageSink : IDisposable - { - public static int InstantiationCount; - private IMessageSink _messageSink; - - public IMessageSink MessageSink => _messageSink; - - public MyAssemblyFixtureWithMessageSink(IMessageSink messageSink) - { - _messageSink = messageSink; - InstantiationCount++; - } - - public void Dispose() +using Xunit.Extensions.AssemblyFixture; + +[assembly: TestFramework(AssemblyFixtureFramework.TypeName, AssemblyFixtureFramework.AssemblyName)] +namespace AssemblyFixture.Tests +{ + public class Sample1 : IAssemblyFixture + { + private readonly MyAssemblyFixture _fixture; + + // Fixtures are injectable into the test classes, just like with class and collection fixtures + public Sample1(MyAssemblyFixture fixture) + { + _fixture = fixture; + } + + [Fact] + public void EnsureSingleton() + { + Assert.Equal(1, MyAssemblyFixture.InstantiationCount); + } + } + + public class Sample2 : IAssemblyFixture + { + private readonly MyAssemblyFixture _fixture; + + public Sample2(MyAssemblyFixture fixture) + { + _fixture = fixture; + } + + [Fact] + public void EnsureSingleton() + { + Assert.Equal(1, MyAssemblyFixture.InstantiationCount); + } + } + + public class Sample3 : IAssemblyFixture + { + private readonly MyAssemblyFixtureWithMessageSink _fixture; + + public Sample3(MyAssemblyFixtureWithMessageSink fixture) + { + _fixture = fixture; + } + + [Fact] + public void EnsureThatHaveIMessageSink() + { + Assert.NotNull(_fixture.MessageSink); + } + } + + public class MyAssemblyFixture : IDisposable + { + public static int InstantiationCount; + + public MyAssemblyFixture() + { + InstantiationCount++; + } + + public void Dispose() + { + // Uncomment this and it will surface as an assembly cleanup failure + //throw new DivideByZeroException(); + //InstantiationCount = 0; + } + } + + public class MyAssemblyFixtureWithMessageSink : IDisposable + { + public static int InstantiationCount; + + public IMessageSink MessageSink { get; } + + public MyAssemblyFixtureWithMessageSink(IMessageSink messageSink) + { + MessageSink = messageSink; + InstantiationCount++; + } + + public void Dispose() { // Uncomment this and it will surface as an assembly cleanup failure //throw new DivideByZeroException(); //InstantiationCount = 0; - } - } + } + } } \ No newline at end of file