1010using Microsoft . CodeAnalysis . CSharp . Shared . Extensions ;
1111using Microsoft . CodeAnalysis . Editor . UnitTests . CodeActions ;
1212using Microsoft . CodeAnalysis . Editor . UnitTests . Diagnostics . NamingStyles ;
13+ using Microsoft . CodeAnalysis . Formatting ;
1314using Microsoft . CodeAnalysis . ImplementType ;
1415using Microsoft . CodeAnalysis . Test . Utilities ;
1516using Microsoft . CodeAnalysis . Testing ;
@@ -578,7 +579,6 @@ public void Method1()
578579 throw new System.NotImplementedException();
579580 }
580581 }
581-
582582 """ ) ;
583583
584584 [ Theory , CombinatorialData , WorkItem ( "https://github.com/dotnet/roslyn/issues/26323" ) ]
@@ -2087,7 +2087,6 @@ public object GetService(Type serviceType)
20872087 throw new NotImplementedException();
20882088 }
20892089 }
2090-
20912090 """ ) ;
20922091
20932092 [ Fact , WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/540318" ) ]
@@ -3107,8 +3106,7 @@ abstract class Goo : IGoo
31073106 {
31083107 public event EventHandler E;
31093108 }
3110- """ ,
3111- index : 0 ) ;
3109+ """ ) ;
31123110
31133111 [ Fact ]
31143112 public Task TestImplementEventAbstractly ( )
@@ -5687,7 +5685,6 @@ public void Goo<@class>()
56875685 throw new System.NotImplementedException();
56885686 }
56895687 }
5690-
56915688 """ ) ;
56925689
56935690 [ Fact , WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545922" ) ]
@@ -5775,7 +5772,6 @@ public object GetService(Type serviceType)
57755772 throw new NotImplementedException();
57765773 }
57775774 }
5778-
57795775 """ ) ;
57805776
57815777 [ Fact , WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529920" ) ]
@@ -5821,7 +5817,6 @@ public object GetService(Type serviceType)
58215817 throw new NotImplementedException();
58225818 }
58235819 }
5824-
58255820 """ ) ;
58265821
58275822 [ Fact , WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/529947" ) ]
@@ -5863,8 +5858,7 @@ public void Dispose()
58635858 throw new NotImplementedException();
58645859 }
58655860 }
5866-
5867- """ , index : 0 ) ;
5861+ """ ) ;
58685862
58695863 [ Fact , WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/958699" ) ]
58705864 [ WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/994456" ) ]
@@ -5882,7 +5876,6 @@ class C : IDisposable
58825876
58835877 {{ DisposePattern ( "protected virtual " , "C" , "public void " ) }}
58845878 }
5885-
58865879 """ , index : 1 ) ;
58875880
58885881 [ Fact , WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/958699" ) ]
@@ -5902,7 +5895,6 @@ void IDisposable.Dispose()
59025895 throw new NotImplementedException();
59035896 }
59045897 }
5905-
59065898 """ , index : 2 ) ;
59075899
59085900 [ Fact , WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/941469" ) ]
@@ -5946,7 +5938,6 @@ abstract class C : IDisposable
59465938 {
59475939 public abstract void Dispose();
59485940 }
5949-
59505941 """ , index : 2 ) ;
59515942
59525943 [ Fact , WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/958699" ) ]
@@ -5985,7 +5976,6 @@ class C : System.IDisposable
59855976
59865977 {{ DisposePattern ( "protected virtual " , "C" , "void System.IDisposable." , gcPrefix : "System." ) }}
59875978 }
5988-
59895979 """ ,
59905980 CodeActionIndex = 3 ,
59915981
@@ -6024,7 +6014,7 @@ public void F()
60246014 throw new NotImplementedException();
60256015 }
60266016 }
6027- """ , index : 0 ) ;
6017+ """ ) ;
60286018
60296019 [ Fact , WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/951968" ) ]
60306020 public Task TestImplementIDisposableViaBaseInterface ( )
@@ -6138,7 +6128,6 @@ public void Dispose()
61386128 throw new NotImplementedException();
61396129 }
61406130 }
6141-
61426131 """ ) ;
61436132
61446133 [ Fact ]
@@ -6157,7 +6146,6 @@ void IDisposable.Dispose()
61576146 throw new NotImplementedException();
61586147 }
61596148 }
6160-
61616149 """ , index : 1 ) ;
61626150
61636151 [ Fact , WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545924" ) ]
@@ -6230,7 +6218,6 @@ public object GetService(Type serviceType)
62306218 throw new NotImplementedException();
62316219 }
62326220 }
6233-
62346221 """ ) ;
62356222
62366223 [ Fact , WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545939" ) ]
@@ -6250,7 +6237,6 @@ public object GetService(Type serviceType)
62506237 throw new NotImplementedException();
62516238 }
62526239 }
6253-
62546240 """ ) ;
62556241
62566242 [ Fact , WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545939" ) ]
@@ -6270,7 +6256,6 @@ public object GetService(Type serviceType)
62706256 throw new NotImplementedException();
62716257 }
62726258 }
6273-
62746259 """ ) ;
62756260
62766261 [ Fact , WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545939" ) ]
@@ -6290,7 +6275,6 @@ public object GetService(Type serviceType)
62906275 throw new NotImplementedException();
62916276 }
62926277 }
6293-
62946278 """ ) ;
62956279
62966280 [ Fact , WorkItem ( "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545940" ) ]
@@ -7030,7 +7014,7 @@ public void Dispose()
70307014 throw new NotImplementedException();
70317015 }
70327016 }
7033- """ , index : 0 ) ;
7017+ """ ) ;
70347018
70357019 [ Fact ]
70367020 public Task TestImplementInterfaceForIDisposableNonApplicable2 ( )
@@ -7059,7 +7043,7 @@ public void Dispose()
70597043 throw new NotImplementedException();
70607044 }
70617045 }
7062- """ , index : 0 ) ;
7046+ """ ) ;
70637047
70647048 [ Fact ]
70657049 public Task TestImplementInterfaceForExplicitIDisposableWithSealedClass ( )
@@ -10054,7 +10038,6 @@ public void M1()
1005410038 throw new System.NotImplementedException();
1005510039 }
1005610040 }
10057-
1005810041 """ ,
1005910042 } . RunAsync ( ) ;
1006010043
@@ -10085,7 +10068,6 @@ public void M1()
1008510068 throw new System.NotImplementedException();
1008610069 }
1008710070 }
10088-
1008910071 """ ,
1009010072 } . RunAsync ( ) ;
1009110073
@@ -10116,7 +10098,6 @@ public void M1()
1011610098 throw new System.NotImplementedException();
1011710099 }
1011810100 }
10119-
1012010101 """ ,
1012110102 } . RunAsync ( ) ;
1012210103
@@ -10185,7 +10166,6 @@ public void M1()
1018510166 throw new System.NotImplementedException();
1018610167 }
1018710168 }
10188-
1018910169 """ ,
1019010170 } . RunAsync ( ) ;
1019110171
@@ -11900,4 +11880,27 @@ class C1 : I1
1190011880 ReferenceAssemblies = ReferenceAssemblies . Net . Net80 ,
1190111881 LanguageVersion = LanguageVersionExtensions . CSharpNext ,
1190211882 } . RunAsync ( ) ;
11883+
11884+ [ Fact , WorkItem ( "https://github.com/dotnet/roslyn/issues/79584" ) ]
11885+ public Task TestImplementIDisposable_DisposePattern_LF_EndOfLine ( )
11886+ => new VerifyCS . Test
11887+ {
11888+ TestCode = """
11889+ using System;
11890+ class C : {|CS0535:IDisposable|}{|CS1513:|}{|CS1514:|}
11891+ """ . Replace ( "\r \n " , "\n " ) ,
11892+ FixedCode = $$ """
11893+ using System;
11894+ class C : IDisposable
11895+ {
11896+ private bool disposedValue;
11897+
11898+ {{ DisposePattern ( "protected virtual " , "C" , "public void " ) }}
11899+ }
11900+ """ . Replace ( "\r \n " , "\n " ) ,
11901+ CodeActionIndex = 1 ,
11902+ ReferenceAssemblies = ReferenceAssemblies . Net . Net80 ,
11903+ LanguageVersion = LanguageVersionExtensions . CSharpNext ,
11904+ Options = { { FormattingOptions2 . NewLine , "\n " } } ,
11905+ } . RunAsync ( ) ;
1190311906}
0 commit comments