Skip to content

Commit

Permalink
chore(deps): migrate to xunit.v3
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMagee committed Dec 18, 2024
1 parent f5e8bec commit 381cf43
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 24 deletions.
1 change: 1 addition & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<PropertyGroup Label="Build">
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
</PropertyGroup>

<PropertyGroup Label="Signing">
Expand Down
9 changes: 7 additions & 2 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@

<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))"/>

<ItemGroup Label="Package References">
<PropertyGroup Label="Build">
<TargetFramework>net9.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup Label="Package References" Condition="'$(OutputType)' == 'Exe'">
<PackageReference Include="CaseExtensions" Version="1.1.0"/>
<PackageReference Include="coverlet.collector" PrivateAssets="all" Version="6.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="7.0.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0"/>
<PackageReference Include="Moq" Version="4.20.72"/>
<PackageReference Include="xunit" Version="2.9.2"/>
<PackageReference Include="xunit.v3" Version="1.0.0"/>
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" Version="3.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Build">
<TargetFramework>net9.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup Label="Project References">
Expand Down
2 changes: 1 addition & 1 deletion test/Octokit.Webhooks.Test/Octokit.Webhooks.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Build">
<TargetFramework>net9.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup Label="Project References">
Expand Down
6 changes: 5 additions & 1 deletion test/Octokit.Webhooks.Test/WebhookEventProcessorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ public class WebhookEventProcessorTests

[Theory]
[ClassData(typeof(WebhookEventProcessorTestsData))]
public void CanDeserialize(WebhookHeaders headers, string payload, Type expectedType)
public void CanDeserialize(string @event, string payload, Type expectedType)
{
var headers = new WebhookHeaders
{
Event = @event,
};
var result = this.webhookEventProcessor.DeserializeWebhookEvent(headers, payload);
result.Should().BeAssignableTo(expectedType);
}
Expand Down
17 changes: 5 additions & 12 deletions test/Octokit.Webhooks.Test/WebhookEventProcessorTestsData.cs
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
namespace Octokit.Webhooks.Test;

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using CaseExtensions;
using Octokit.Webhooks.TestUtils;
using Xunit;

public class WebhookEventProcessorTestsData : IEnumerable<object[]>
public class WebhookEventProcessorTestsData : IEnumerable<TheoryDataRow<string, string, Type>>
{
public IEnumerator<object[]> GetEnumerator()
public IEnumerator<TheoryDataRow<string, string, Type>> GetEnumerator()
{
var resourcesDirectory = ResourceUtils.GetResources();
var files = Directory.GetFiles(resourcesDirectory, "*.json", SearchOption.AllDirectories);
foreach (var file in files)
{
var relativeResource = file.Replace($"{resourcesDirectory}{Path.DirectorySeparatorChar}", string.Empty);
var parts = relativeResource.Split(Path.DirectorySeparatorChar);
var headers = new WebhookHeaders
{
Event = parts[0],
};
var expectedType = ClassUtils.GetEventTypeByName(parts[0].ToPascalCase());
var content = ResourceUtils.ReadResource(relativeResource);
yield return new object[]
{
headers,
content,
expectedType,
};
yield return new TheoryDataRow<string, string, Type>(parts[0], content, expectedType);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Build">
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk"/>

0 comments on commit 381cf43

Please sign in to comment.