Last change
on this file since 16473 was
16473,
checked in by gkronber, 5 years ago
|
#2520 changed name and type of parameter for StorableConstructor
|
File size:
1.9 KB
|
Line | |
---|
1 | using Microsoft.CodeAnalysis.CodeFixes;
|
---|
2 | using Microsoft.CodeAnalysis.Diagnostics;
|
---|
3 | using Microsoft.VisualStudio.TestTools.UnitTesting;
|
---|
4 | using TestHelper;
|
---|
5 |
|
---|
6 | namespace PersistenceCodeFix.Test {
|
---|
7 | [TestClass]
|
---|
8 | public class UnitTest : CodeFixVerifier {
|
---|
9 | [TestMethod]
|
---|
10 | public void TestMethod1() {
|
---|
11 | var test = @"";
|
---|
12 |
|
---|
13 | VerifyCSharpDiagnostic(test);
|
---|
14 | }
|
---|
15 |
|
---|
16 | [TestMethod]
|
---|
17 | public void TestMethod2() {
|
---|
18 | var test = @"
|
---|
19 | namespace N {
|
---|
20 | class StorableTypeAttribute : System.Attribute
|
---|
21 | {
|
---|
22 | public StorableTypeAttribute(string s)
|
---|
23 | {
|
---|
24 | }
|
---|
25 | }
|
---|
26 | class StorableConstructorAttribute : System.Attribute
|
---|
27 | {
|
---|
28 | }
|
---|
29 |
|
---|
30 | [StorableType(""3BD39A19-27AA-4CA6-A363-84A877648DC2"")]
|
---|
31 | class A
|
---|
32 | {
|
---|
33 | [StorableConstructor]
|
---|
34 | protected A(StorableConstructorFlag _)
|
---|
35 | {
|
---|
36 | }
|
---|
37 | }
|
---|
38 |
|
---|
39 | [StorableType(""254FCBA9-1E7F-4948-8140-52F998C47ADC"")]
|
---|
40 | class B : A
|
---|
41 | {
|
---|
42 | }
|
---|
43 | }";
|
---|
44 |
|
---|
45 |
|
---|
46 | var fixtest = @"
|
---|
47 | namespace N {
|
---|
48 | class StorableTypeAttribute : System.Attribute
|
---|
49 | {
|
---|
50 | public StorableTypeAttribute(string s)
|
---|
51 | {
|
---|
52 | }
|
---|
53 | }
|
---|
54 | class StorableConstructorAttribute : System.Attribute
|
---|
55 | {
|
---|
56 | }
|
---|
57 |
|
---|
58 | [StorableType(""3BD39A19-27AA-4CA6-A363-84A877648DC2"")]
|
---|
59 | class A
|
---|
60 | {
|
---|
61 | [StorableConstructor]
|
---|
62 | protected A(StorableConstructorFlag _)
|
---|
63 | {
|
---|
64 | }
|
---|
65 | }
|
---|
66 |
|
---|
67 | [StorableType(""254FCBA9-1E7F-4948-8140-52F998C47ADC"")]
|
---|
68 | class B : A
|
---|
69 | {
|
---|
70 | [StorableConstructor]
|
---|
71 | protected B(StorableConstructorFlag _) : base(_)
|
---|
72 | {
|
---|
73 | }
|
---|
74 | }
|
---|
75 | }";
|
---|
76 | VerifyCSharpFix(test, fixtest);
|
---|
77 | }
|
---|
78 |
|
---|
79 | protected override CodeFixProvider GetCSharpCodeFixProvider() {
|
---|
80 | return new MissingStorableConstructorFix();
|
---|
81 | }
|
---|
82 |
|
---|
83 | protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer() {
|
---|
84 | return new MissingStorableConstructorAnalyzer();
|
---|
85 | }
|
---|
86 | }
|
---|
87 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.