@@ -310,6 +310,63 @@ public void GenerateFiles_When_MixedVisibility_Should_GenerateCorrectFiles()
310310 }
311311 }
312312
313+ [ Fact ]
314+ public void GenerateFiles_When_NoSetter_Should_GenerateCorrectFiles ( )
315+ {
316+ // Arrange
317+ var fileNames = new [ ]
318+ {
319+ "ProxyInterfaceSourceGeneratorTests.Source.IBar.g.cs" ,
320+ "ProxyInterfaceSourceGeneratorTests.Source.INoSetter.g.cs" ,
321+ "ProxyInterfaceSourceGeneratorTests.Source.BarProxy.g.cs" ,
322+ "ProxyInterfaceSourceGeneratorTests.Source.NoSetterProxy.g.cs"
323+ } ;
324+
325+ var pathNoSetter = Path . Combine ( _basePath , "Source/INoSetter.cs" ) ;
326+ var sourceFileNoSetter = new SourceFile
327+ {
328+ Path = pathNoSetter ,
329+ Text = File . ReadAllText ( pathNoSetter ) ,
330+ AttributeToAddToInterface = new ExtraAttribute
331+ {
332+ Name = "ProxyInterfaceGenerator.Proxy" ,
333+ ArgumentList = "typeof(ProxyInterfaceSourceGeneratorTests.Source.NoSetter)"
334+ }
335+ } ;
336+
337+ var pathBar = Path . Combine ( _basePath , "Source/IBar.cs" ) ;
338+ var sourceFileBar = new SourceFile
339+ {
340+ Path = pathBar ,
341+ Text = File . ReadAllText ( pathBar ) ,
342+ AttributeToAddToInterface = new ExtraAttribute
343+ {
344+ Name = "ProxyInterfaceGenerator.Proxy" ,
345+ ArgumentList = "typeof(ProxyInterfaceSourceGeneratorTests.Source.Bar)"
346+ }
347+ } ;
348+
349+ // Act
350+ var result = _sut . Execute ( [
351+ sourceFileBar ,
352+ sourceFileNoSetter ,
353+ ] ) ;
354+
355+ // Assert
356+ result . Valid . Should ( ) . BeTrue ( ) ;
357+ result . Files . Should ( ) . HaveCount ( fileNames . Length + 1 ) ;
358+
359+ foreach ( var fileName in fileNames . Select ( ( fileName , index ) => new { fileName , index } ) )
360+ {
361+ var builder = result . Files [ fileName . index + 1 ] ; // +1 means skip the attribute
362+ builder . Path . Should ( ) . EndWith ( fileName . fileName ) ;
363+
364+ var destinationFilename = Path . Combine ( _basePath , $ "Destination/{ fileName . fileName } ") ;
365+ if ( Write ) File . WriteAllText ( destinationFilename , builder . Text ) ;
366+ builder . Text . Should ( ) . Be ( File . ReadAllText ( destinationFilename ) ) ;
367+ }
368+ }
369+
313370 [ Fact ]
314371 public void GenerateFiles_ForSingleClass_Should_GenerateCorrectFiles ( )
315372 {
0 commit comments