-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Commented out tests get errror that I don't understand analyzer was t…
…ested manually and seems to work.
- Loading branch information
1 parent
5963b78
commit f778172
Showing
1 changed file
with
121 additions
and
0 deletions.
There are no files selected for viewing
121 changes: 121 additions & 0 deletions
121
Tests/TimeWarp.State.Analyzer.Tests/StateReadOnlyPublicPropertiesAnalyzer_Tests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// // ReSharper disable InconsistentNaming | ||
// namespace StateReadOnlyPublicPropertiesAnalyzer_; | ||
// | ||
// public class Should_Trigger_StateReadOnlyPublicPropertiesRule | ||
// { | ||
// public static async Task Given_PublicPropertyWithPublicSetter() | ||
// { | ||
// const string TestCode = | ||
// """ | ||
// using System.Threading.Tasks; | ||
// using TimeWarp.State; | ||
// | ||
// public class SampleState : State<SampleState> | ||
// { | ||
// public int PublicProperty { get; set; } | ||
// | ||
// public override void Initialize() { } | ||
// } | ||
// """; | ||
// | ||
// var expectedDiagnostic = new DiagnosticResult("StateReadOnlyPublicPropertiesRule", DiagnosticSeverity.Warning) | ||
// .WithSpan(6, 16, 6, 30) | ||
// .WithArguments("PublicProperty"); | ||
// | ||
// var analyzerTest = new CSharpAnalyzerTest<StateReadOnlyPublicPropertiesAnalyzer, FixieVerifier> | ||
// { | ||
// TestCode = TestCode | ||
// }; | ||
// | ||
// analyzerTest.ExpectedDiagnostics.Add(expectedDiagnostic); | ||
// | ||
// const string TimeWarpStateAssemblyPath = @"TimeWarp.State.dll"; | ||
// analyzerTest.TestState.AdditionalReferences.Add(MetadataReference.CreateFromFile(TimeWarpStateAssemblyPath)); | ||
// | ||
// await analyzerTest.RunAsync(); | ||
// } | ||
// | ||
// public static async Task Given_PublicPropertyWithProtectedSetter() | ||
// { | ||
// const string TestCode = | ||
// """ | ||
// using System.Threading.Tasks; | ||
// using TimeWarp.State; | ||
// | ||
// public class SampleState : State<SampleState> | ||
// { | ||
// public int PublicProperty { get; protected set; } | ||
// | ||
// public override void Initialize() { } | ||
// } | ||
// """; | ||
// | ||
// var expectedDiagnostic = new DiagnosticResult("StateReadOnlyPublicPropertiesRule", DiagnosticSeverity.Warning) | ||
// .WithSpan(6, 16, 6, 30) | ||
// .WithArguments("PublicProperty"); | ||
// | ||
// var analyzerTest = new CSharpAnalyzerTest<StateReadOnlyPublicPropertiesAnalyzer, FixieVerifier> | ||
// { | ||
// TestCode = TestCode | ||
// }; | ||
// | ||
// analyzerTest.ExpectedDiagnostics.Add(expectedDiagnostic); | ||
// | ||
// const string TimeWarpStateAssemblyPath = @"TimeWarp.State.dll"; | ||
// analyzerTest.TestState.AdditionalReferences.Add(MetadataReference.CreateFromFile(TimeWarpStateAssemblyPath)); | ||
// | ||
// await analyzerTest.RunAsync(); | ||
// } | ||
// | ||
// public static async Task Given_PublicPropertyWithPrivateSetter() | ||
// { | ||
// const string TestCode = | ||
// """ | ||
// using System.Threading.Tasks; | ||
// using TimeWarp.State; | ||
// | ||
// public class SampleState : State<SampleState> | ||
// { | ||
// public int PublicProperty { get; private set; } | ||
// | ||
// public override void Initialize() { } | ||
// } | ||
// """; | ||
// | ||
// var analyzerTest = new CSharpAnalyzerTest<StateReadOnlyPublicPropertiesAnalyzer, FixieVerifier> | ||
// { | ||
// TestCode = TestCode | ||
// }; | ||
// | ||
// const string TimeWarpStateAssemblyPath = @"TimeWarp.State.dll"; | ||
// analyzerTest.TestState.AdditionalReferences.Add(MetadataReference.CreateFromFile(TimeWarpStateAssemblyPath)); | ||
// | ||
// await analyzerTest.RunAsync(); | ||
// } | ||
// | ||
// public static async Task Given_PublicReadOnlyProperty() | ||
// { | ||
// const string TestCode = | ||
// """ | ||
// using System.Threading.Tasks; | ||
// using TimeWarp.State; | ||
// | ||
// public class SampleState : State<SampleState> | ||
// { | ||
// public int PublicProperty { get; } | ||
// | ||
// public override void Initialize() { } | ||
// } | ||
// """; | ||
// | ||
// var analyzerTest = new CSharpAnalyzerTest<StateReadOnlyPublicPropertiesAnalyzer, FixieVerifier> | ||
// { | ||
// TestCode = TestCode | ||
// }; | ||
// | ||
// const string TimeWarpStateAssemblyPath = @"TimeWarp.State.dll"; | ||
// analyzerTest.TestState.AdditionalReferences.Add(MetadataReference.CreateFromFile(TimeWarpStateAssemblyPath)); | ||
// | ||
// await analyzerTest.RunAsync(); | ||
// } | ||
// } |