Skip to content

Commit

Permalink
Merge pull request #103 from CodebreakerApp/102-analyzer-dotnet8
Browse files Browse the repository at this point in the history
update analyzer package to .net 8
  • Loading branch information
christiannagel authored Dec 9, 2023
2 parents 78ad2cb + fefda8f commit 8d7fef3
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public void SetMoveShouldReturnThreeWhite()
{
ColorResult expectedKeyPegs = new(0, 3);
ColorResult? resultKeyPegs = TestSkeleton(
new[] { Green, Yellow, Green, Black },
new[] { Yellow, Green, Black, Blue }
[Green, Yellow, Green, Black],
[Yellow, Green, Black, Blue]
);

Assert.Equal(expectedKeyPegs, resultKeyPegs);
Expand All @@ -23,7 +23,7 @@ public void SetMoveShouldReturnThreeWhite()
[Theory]
public void SetMoveUsingVariousData(int expectedBlack, int expectedWhite, params string[] guessValues)
{
string[] code = new[] { Red, Green, Blue, Red };
string[] code = [Red, Green, Blue, Red];
ColorResult expectedKeyPegs = new (expectedBlack, expectedWhite);
ColorResult resultKeyPegs = TestSkeleton(code, guessValues);
Assert.Equal(expectedKeyPegs, resultKeyPegs);
Expand All @@ -42,8 +42,8 @@ public void ShouldThrowOnInvalidGuessCount()
{
Assert.Throws<ArgumentException>(() =>
TestSkeleton(
new[] { "Black", "Black", "Black", "Black" },
new[] { "Black" }
["Black", "Black", "Black", "Black"],
["Black"]
));
}

Expand All @@ -52,8 +52,8 @@ public void ShouldThrowOnInvalidGuessValues()
{
Assert.Throws<ArgumentException>(() =>
TestSkeleton(
new[] { "Black", "Black", "Black", "Black" },
new[] { "Black", "Der", "Blue", "Yellow" } // "Der" is the wrong value
["Black", "Black", "Black", "Black"],
["Black", "Der", "Blue", "Yellow"] // "Der" is the wrong value
));
}

Expand All @@ -62,8 +62,8 @@ public void ShouldThrowOnInvalidMoveNumber()
{
Assert.Throws<ArgumentException>(() =>
TestSkeleton(
new[] { Green, Yellow, Green, Black },
new[] { Yellow, Green, Black, Blue }, moveNumber: 2));
[Green, Yellow, Green, Black],
[Yellow, Green, Black, Blue], moveNumber: 2));
}

private static ColorResult TestSkeleton(string[] codes, string[] guesses, int moveNumber = 1)
Expand All @@ -88,7 +88,7 @@ private static ColorResult TestSkeleton(string[] codes, string[] guesses, int mo

public class TestData6x4 : IEnumerable<object[]>
{
public static readonly string[] Colors6 = { Red, Green, Blue, Yellow, Black, White };
public static readonly string[] Colors6 = [Red, Green, Blue, Yellow, Black, White];

public IEnumerator<object[]> GetEnumerator()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public void SetMoveShouldReturnThreeWhite()
{
ColorResult expectedKeyPegs = new(0, 3);
ColorResult? resultKeyPegs = TestSkeleton(
new[] { Green, Yellow, Green, Black, Orange },
new[] { Yellow, Green, Black, Blue, Blue }
[Green, Yellow, Green, Black, Orange],
[Yellow, Green, Black, Blue, Blue]
);

Assert.Equal(expectedKeyPegs, resultKeyPegs);
Expand All @@ -25,7 +25,7 @@ public void SetMoveShouldReturnThreeWhite()
[Theory]
public void SetMoveUsingVariousData(int expectedBlack, int expectedWhite, params string[] guessValues)
{
string[] code = new[] { Red, Green, Blue, Red, Brown };
string[] code = [Red, Green, Blue, Red, Brown];
ColorResult expectedKeyPegs = new (expectedBlack, expectedWhite);
ColorResult resultKeyPegs = TestSkeleton(code, guessValues);
Assert.Equal(expectedKeyPegs, resultKeyPegs);
Expand All @@ -44,8 +44,8 @@ public void ShouldThrowOnInvalidGuessCount()
{
Assert.Throws<ArgumentException>(() =>
TestSkeleton(
new[] { "Black", "Black", "Black", "Black", "Black" },
new[] { "Black" }
["Black", "Black", "Black", "Black", "Black"],
["Black"]
));
}

Expand All @@ -54,8 +54,8 @@ public void ShouldThrowOnInvalidGuessValues()
{
Assert.Throws<ArgumentException>(() =>
TestSkeleton(
new[] { "Black", "Black", "Black", "Black", "Black" },
new[] { "Black", "Der", "Blue", "Yellow", "Black" } // "Der" is the wrong value
["Black", "Black", "Black", "Black", "Black"],
["Black", "Der", "Blue", "Yellow", "Black"] // "Der" is the wrong value
));
}

Expand All @@ -81,7 +81,7 @@ private static ColorResult TestSkeleton(string[] codes, string[] guesses)

public class TestData8x5 : IEnumerable<object[]>
{
public static readonly string[] Colors8 = new string[] { Red, Blue, Green, Yellow, Black, White, Purple, Orange };
public static readonly string[] Colors8 = [Red, Blue, Green, Yellow, Black, White, Purple, Orange];

public IEnumerator<object[]> GetEnumerator()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public void SetMoveShouldReturnThreeBlue()
{
ShapeAndColorResult expectedKeyPegs = new(0, 3, 0);
ShapeAndColorResult? resultKeyPegs = TestSkeleton(
new string[] { "Rectangle;Green", "Circle;Yellow", "Rectangle;Green", "Star;Blue"},
new string[] {"Circle;Yellow", "Rectangle;Green", "Star;Blue", "Square;Purple"}
["Rectangle;Green", "Circle;Yellow", "Rectangle;Green", "Star;Blue"],
["Circle;Yellow", "Rectangle;Green", "Star;Blue", "Square;Purple"]
);

Assert.Equal(expectedKeyPegs, resultKeyPegs);
Expand Down Expand Up @@ -88,8 +88,8 @@ private static ShapeAndColorResult TestSkeleton(string[] codes, string[] guesses

public class TestData5x5x4 : IEnumerable<object[]>
{
public static readonly string[] Colors5 = { Red, Green, Blue, Yellow, Purple };
public static readonly string[] Shapes5 = { Circle, Square, Triangle, Star, Rectangle };
public static readonly string[] Colors5 = [Red, Green, Blue, Yellow, Purple];
public static readonly string[] Shapes5 = [Circle, Square, Triangle, Star, Rectangle];

public IEnumerator<object[]> GetEnumerator()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand All @@ -10,10 +10,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="xunit" Version="2.5.1" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand All @@ -28,8 +28,4 @@
<ProjectReference Include="..\Codebreaker.GameAPIs.Analyzers\Codebreaker.Analyzers.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Fields\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class SimpleColorResultTests
[Fact]
public void ToStringShouldReturnFormat()
{
ResultValue[] values = { ResultValue.CorrectColor, ResultValue.CorrectPositionAndColor, ResultValue.Incorrect, ResultValue.Incorrect };
ResultValue[] values = [ResultValue.CorrectColor, ResultValue.CorrectPositionAndColor, ResultValue.Incorrect, ResultValue.Incorrect];
SimpleColorResult result = new(values);
string actual = result.ToString();
Assert.Equal("1:2:0:0", actual);
Expand All @@ -14,7 +14,7 @@ public void ToStringShouldReturnFormat()
[Fact]
public void ParseShouldReturnColorResult()
{
ResultValue[] values = { ResultValue.CorrectColor, ResultValue.CorrectPositionAndColor, ResultValue.Incorrect, ResultValue.Incorrect };
ResultValue[] values = [ResultValue.CorrectColor, ResultValue.CorrectPositionAndColor, ResultValue.Incorrect, ResultValue.Incorrect];
SimpleColorResult expected = new(values);
var actual = SimpleColorResult.Parse("1:2:0:0");
Assert.Equal(expected, actual);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
<LangVersion>12.0</LangVersion>
<PackageTags>
Codebreaker;CNinnovation;GameAnalyzers;
</PackageTags>
Expand Down

0 comments on commit 8d7fef3

Please sign in to comment.