Skip to content

Commit

Permalink
Update gitversion tasks
Browse files Browse the repository at this point in the history
Add: dotnet 5 & 6
code cleanup
  • Loading branch information
JDCain committed Nov 30, 2021
1 parent 6cbe4ab commit a4ce050
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 96 deletions.
11 changes: 6 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion src/AssemblyFixture.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net452;netstandard2.1;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net452;netstandard2.1;netstandard2.0;net5.0;net6.0</TargetFrameworks>
<Version>0.1.0</Version>
<Authors>kzu, J.D. Cain</Authors>
<Product />
Expand Down
2 changes: 1 addition & 1 deletion test/AssemblyFixture.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>net472;netcoreapp3.0;net5.0;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
177 changes: 88 additions & 89 deletions test/Samples.cs
Original file line number Diff line number Diff line change
@@ -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>
{
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>
{
MyAssemblyFixture fixture;

public Sample2(MyAssemblyFixture fixture)
{
this.fixture = fixture;
}

[Fact]
public void EnsureSingleton()
{
Assert.Equal(1, MyAssemblyFixture.InstantiationCount);
}
}

public class Sample3 : IAssemblyFixture<MyAssemblyFixtureWithMessageSink>
{
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<MyAssemblyFixture>
{
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<MyAssemblyFixture>
{
private readonly MyAssemblyFixture _fixture;

public Sample2(MyAssemblyFixture fixture)
{
_fixture = fixture;
}

[Fact]
public void EnsureSingleton()
{
Assert.Equal(1, MyAssemblyFixture.InstantiationCount);
}
}

public class Sample3 : IAssemblyFixture<MyAssemblyFixtureWithMessageSink>
{
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;
}
}
}
}
}

0 comments on commit a4ce050

Please sign in to comment.