Skip to content

Commit 8d7fef3

Browse files
Merge pull request #103 from CodebreakerApp/102-analyzer-dotnet8
update analyzer package to .net 8
2 parents 78ad2cb + fefda8f commit 8d7fef3

File tree

6 files changed

+29
-33
lines changed

6 files changed

+29
-33
lines changed

src/services/gameapi/Codebreaker.GameAPIs.Analyzers.Tests/Analyzers/ColorGame6x4AnalyzerTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public void SetMoveShouldReturnThreeWhite()
1111
{
1212
ColorResult expectedKeyPegs = new(0, 3);
1313
ColorResult? resultKeyPegs = TestSkeleton(
14-
new[] { Green, Yellow, Green, Black },
15-
new[] { Yellow, Green, Black, Blue }
14+
[Green, Yellow, Green, Black],
15+
[Yellow, Green, Black, Blue]
1616
);
1717

1818
Assert.Equal(expectedKeyPegs, resultKeyPegs);
@@ -23,7 +23,7 @@ public void SetMoveShouldReturnThreeWhite()
2323
[Theory]
2424
public void SetMoveUsingVariousData(int expectedBlack, int expectedWhite, params string[] guessValues)
2525
{
26-
string[] code = new[] { Red, Green, Blue, Red };
26+
string[] code = [Red, Green, Blue, Red];
2727
ColorResult expectedKeyPegs = new (expectedBlack, expectedWhite);
2828
ColorResult resultKeyPegs = TestSkeleton(code, guessValues);
2929
Assert.Equal(expectedKeyPegs, resultKeyPegs);
@@ -42,8 +42,8 @@ public void ShouldThrowOnInvalidGuessCount()
4242
{
4343
Assert.Throws<ArgumentException>(() =>
4444
TestSkeleton(
45-
new[] { "Black", "Black", "Black", "Black" },
46-
new[] { "Black" }
45+
["Black", "Black", "Black", "Black"],
46+
["Black"]
4747
));
4848
}
4949

@@ -52,8 +52,8 @@ public void ShouldThrowOnInvalidGuessValues()
5252
{
5353
Assert.Throws<ArgumentException>(() =>
5454
TestSkeleton(
55-
new[] { "Black", "Black", "Black", "Black" },
56-
new[] { "Black", "Der", "Blue", "Yellow" } // "Der" is the wrong value
55+
["Black", "Black", "Black", "Black"],
56+
["Black", "Der", "Blue", "Yellow"] // "Der" is the wrong value
5757
));
5858
}
5959

@@ -62,8 +62,8 @@ public void ShouldThrowOnInvalidMoveNumber()
6262
{
6363
Assert.Throws<ArgumentException>(() =>
6464
TestSkeleton(
65-
new[] { Green, Yellow, Green, Black },
66-
new[] { Yellow, Green, Black, Blue }, moveNumber: 2));
65+
[Green, Yellow, Green, Black],
66+
[Yellow, Green, Black, Blue], moveNumber: 2));
6767
}
6868

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

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

9393
public IEnumerator<object[]> GetEnumerator()
9494
{

src/services/gameapi/Codebreaker.GameAPIs.Analyzers.Tests/Analyzers/ColorGame8x5AnalyzerTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public void SetMoveShouldReturnThreeWhite()
1313
{
1414
ColorResult expectedKeyPegs = new(0, 3);
1515
ColorResult? resultKeyPegs = TestSkeleton(
16-
new[] { Green, Yellow, Green, Black, Orange },
17-
new[] { Yellow, Green, Black, Blue, Blue }
16+
[Green, Yellow, Green, Black, Orange],
17+
[Yellow, Green, Black, Blue, Blue]
1818
);
1919

2020
Assert.Equal(expectedKeyPegs, resultKeyPegs);
@@ -25,7 +25,7 @@ public void SetMoveShouldReturnThreeWhite()
2525
[Theory]
2626
public void SetMoveUsingVariousData(int expectedBlack, int expectedWhite, params string[] guessValues)
2727
{
28-
string[] code = new[] { Red, Green, Blue, Red, Brown };
28+
string[] code = [Red, Green, Blue, Red, Brown];
2929
ColorResult expectedKeyPegs = new (expectedBlack, expectedWhite);
3030
ColorResult resultKeyPegs = TestSkeleton(code, guessValues);
3131
Assert.Equal(expectedKeyPegs, resultKeyPegs);
@@ -44,8 +44,8 @@ public void ShouldThrowOnInvalidGuessCount()
4444
{
4545
Assert.Throws<ArgumentException>(() =>
4646
TestSkeleton(
47-
new[] { "Black", "Black", "Black", "Black", "Black" },
48-
new[] { "Black" }
47+
["Black", "Black", "Black", "Black", "Black"],
48+
["Black"]
4949
));
5050
}
5151

@@ -54,8 +54,8 @@ public void ShouldThrowOnInvalidGuessValues()
5454
{
5555
Assert.Throws<ArgumentException>(() =>
5656
TestSkeleton(
57-
new[] { "Black", "Black", "Black", "Black", "Black" },
58-
new[] { "Black", "Der", "Blue", "Yellow", "Black" } // "Der" is the wrong value
57+
["Black", "Black", "Black", "Black", "Black"],
58+
["Black", "Der", "Blue", "Yellow", "Black"] // "Der" is the wrong value
5959
));
6060
}
6161

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

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

8686
public IEnumerator<object[]> GetEnumerator()
8787
{

src/services/gameapi/Codebreaker.GameAPIs.Analyzers.Tests/Analyzers/ShapeGame5x5x4AnalyzerTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public void SetMoveShouldReturnThreeBlue()
1515
{
1616
ShapeAndColorResult expectedKeyPegs = new(0, 3, 0);
1717
ShapeAndColorResult? resultKeyPegs = TestSkeleton(
18-
new string[] { "Rectangle;Green", "Circle;Yellow", "Rectangle;Green", "Star;Blue"},
19-
new string[] {"Circle;Yellow", "Rectangle;Green", "Star;Blue", "Square;Purple"}
18+
["Rectangle;Green", "Circle;Yellow", "Rectangle;Green", "Star;Blue"],
19+
["Circle;Yellow", "Rectangle;Green", "Star;Blue", "Square;Purple"]
2020
);
2121

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

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

9494
public IEnumerator<object[]> GetEnumerator()
9595
{
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net7.0</TargetFramework>
4+
<TargetFramework>net8.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

@@ -10,10 +10,10 @@
1010
</PropertyGroup>
1111

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

31-
<ItemGroup>
32-
<Folder Include="Fields\" />
33-
</ItemGroup>
34-
3531
</Project>

src/services/gameapi/Codebreaker.GameAPIs.Analyzers.Tests/Results/SimpleColorResultTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public class SimpleColorResultTests
55
[Fact]
66
public void ToStringShouldReturnFormat()
77
{
8-
ResultValue[] values = { ResultValue.CorrectColor, ResultValue.CorrectPositionAndColor, ResultValue.Incorrect, ResultValue.Incorrect };
8+
ResultValue[] values = [ResultValue.CorrectColor, ResultValue.CorrectPositionAndColor, ResultValue.Incorrect, ResultValue.Incorrect];
99
SimpleColorResult result = new(values);
1010
string actual = result.ToString();
1111
Assert.Equal("1:2:0:0", actual);
@@ -14,7 +14,7 @@ public void ToStringShouldReturnFormat()
1414
[Fact]
1515
public void ParseShouldReturnColorResult()
1616
{
17-
ResultValue[] values = { ResultValue.CorrectColor, ResultValue.CorrectPositionAndColor, ResultValue.Incorrect, ResultValue.Incorrect };
17+
ResultValue[] values = [ResultValue.CorrectColor, ResultValue.CorrectPositionAndColor, ResultValue.Incorrect, ResultValue.Incorrect];
1818
SimpleColorResult expected = new(values);
1919
var actual = SimpleColorResult.Parse("1:2:0:0");
2020
Assert.Equal(expected, actual);

src/services/gameapi/Codebreaker.GameAPIs.Analyzers/Codebreaker.Analyzers.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
8-
<LangVersion>preview</LangVersion>
8+
<LangVersion>12.0</LangVersion>
99
<PackageTags>
1010
Codebreaker;CNinnovation;GameAnalyzers;
1111
</PackageTags>

0 commit comments

Comments
 (0)