Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ partial class Foo
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ partial class Foo
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ partial class Foo
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ partial class Foo
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ partial class Base
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ partial class Base
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ partial class Base
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ partial class Base
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ partial class Derived
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ partial class Derived
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public sealed override global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ partial class Bar
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ partial class TestClass1<U>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand All @@ -39,7 +39,7 @@ partial class TestClass2
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand All @@ -58,7 +58,7 @@ partial class TestClass3<T1, T2>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ partial class Bar
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ partial record Bar
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ partial record Bar
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Verify.MSTest.SourceGenerator", "1.0.0.0")]
public global::Microsoft.VisualStudio.TestTools.UnitTesting.TestContext TestContext
{
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;
get => global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;
set => global::VerifyMSTest.Verifier.CurrentTestContext.Value = new global::VerifyMSTest.TestExecutionContext(value, GetType());
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/Verify.MSTest.SourceGenerator/Emitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ void AppendCallBaseSetter() =>
}
""");

// No null forgiving operator: a consuming project targeting net4x defaults to
// LangVersion 7.3, where `!` is CS8370. The generated file is <auto-generated />,
// so nullable warnings are suppressed there anyway.
static string GetterBody(PropertyFlags flags) =>
flags.HasFlag(PropertyFlags.CallBase)
? "base.TestContext;"
: "global::VerifyMSTest.Verifier.CurrentTestContext.Value!.TestContext;";
: "global::VerifyMSTest.Verifier.CurrentTestContext.Value.TestContext;";

static string GetModifiers(PropertyFlags flags) =>
flags.HasFlag(PropertyFlags.Override)
Expand Down
Loading