diff --git a/global.json b/global.json index 6ca92cf..4c8007c 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.102", + "version": "8.0.405", "rollForward": "latestFeature" } } \ No newline at end of file diff --git a/samples/ObjectAssertions.Sample/ObjectAssertions.Sample.csproj b/samples/ObjectAssertions.Sample/ObjectAssertions.Sample.csproj index ec4d7fa..dea1281 100644 --- a/samples/ObjectAssertions.Sample/ObjectAssertions.Sample.csproj +++ b/samples/ObjectAssertions.Sample/ObjectAssertions.Sample.csproj @@ -1,9 +1,10 @@  - net7.0 + net8.0 enable false + true diff --git a/samples/ObjectAssertions.Sample/Program.cs b/samples/ObjectAssertions.Sample/Program.cs index 76e5e95..92bc4b6 100644 --- a/samples/ObjectAssertions.Sample/Program.cs +++ b/samples/ObjectAssertions.Sample/Program.cs @@ -1,4 +1,5 @@ using ObjectAssertions.Abstractions; +using System; using Xunit; using static ObjectAssertions.Sample.ObjectToAssert; @@ -22,6 +23,9 @@ public record ObjectToAssert : Base public int? NullableNumber { get; set; } = 5; public NestedObject NestedObjectValue { get; set; } = new NestedObject(); + [Obsolete] + public string ObsoleteValue { get; set; } = "I'm obsolete"; + public enum ExampleEnum { Option1, Option2, Option3 }; public record NestedObject(int NestedInt = 5, string NestedString = "ubuaa"); @@ -58,6 +62,7 @@ public void HowTo() IntegerNumber = i => Assert.Equal(30, i), NullableNumber = n => Assert.Equal(5, n), StringValue = s => Assert.Equal("Hello world", s), + ObsoleteValue = o => Assert.Equal("I'm obsolete", o), // Obsolete warnings are ignored in generated code NestedObjectValue = n => new NestedObjectAssertions(n) { NestedInt = ObjectAssertionsHelpers.Ignore("Out of test scope"), diff --git a/src/ObjectAssertions.Abstractions/ObjectAssertions.Abstractions.csproj b/src/ObjectAssertions.Abstractions/ObjectAssertions.Abstractions.csproj index bd1c243..6b29f56 100644 --- a/src/ObjectAssertions.Abstractions/ObjectAssertions.Abstractions.csproj +++ b/src/ObjectAssertions.Abstractions/ObjectAssertions.Abstractions.csproj @@ -3,7 +3,7 @@ netstandard2.0 true - 8 + 11 enable diff --git a/src/ObjectAssertions/Generator/ClassGenerator.cs b/src/ObjectAssertions/Generator/ClassGenerator.cs index 7908dbf..a44b96b 100644 --- a/src/ObjectAssertions/Generator/ClassGenerator.cs +++ b/src/ObjectAssertions/Generator/ClassGenerator.cs @@ -80,12 +80,14 @@ private string GenerateSource() private void GenerateAutogeneratedHeader(IndentedTextWriter sourceWriter) { - string header = @" - //------------------------------------------------------------------------------ - // - // This code was generated by a source gnerator. - // - //------------------------------------------------------------------------------"; + string header = """ + //------------------------------------------------------------------------------ + // + // This code was generated by a source gnerator. + // + //------------------------------------------------------------------------------ + #pragma warning disable CS0612 + """; sourceWriter.WriteLine(header); } diff --git a/src/ObjectAssertions/ObjectAssertions.csproj b/src/ObjectAssertions/ObjectAssertions.csproj index 410e200..36cb2c4 100644 --- a/src/ObjectAssertions/ObjectAssertions.csproj +++ b/src/ObjectAssertions/ObjectAssertions.csproj @@ -5,7 +5,7 @@ enable true true - 9 + 11 0.0.0-preview1