File tree Expand file tree Collapse file tree 4 files changed +48
-4
lines changed
Abc.Zebus.MessageDsl.Tests/MessageDsl
Abc.Zebus.MessageDsl/Generator Expand file tree Collapse file tree 4 files changed +48
-4
lines changed Original file line number Diff line number Diff line change @@ -352,7 +352,7 @@ public async Task should_handle_obsolete_attribute_1()
352352 }
353353 } ) ;
354354
355- code . ShouldNotContain ( "#pragma warning disable 612 " ) ;
355+ code . ShouldNotContain ( "#pragma warning disable CS0612, CS0618 " ) ;
356356 }
357357
358358 [ Test ]
@@ -370,7 +370,7 @@ public async Task should_handle_obsolete_attribute_2()
370370 }
371371 } ) ;
372372
373- code . ShouldContain ( "#pragma warning disable 612 " ) ;
373+ code . ShouldContain ( "#pragma warning disable CS0612, CS0618 " ) ;
374374 }
375375
376376 [ Test ]
@@ -382,7 +382,19 @@ public async Task should_handle_obsolete_attribute_3()
382382 Attributes = { new AttributeDefinition ( "Obsolete" ) }
383383 } ) ;
384384
385- code . ShouldContain ( "#pragma warning disable 612" ) ;
385+ code . ShouldContain ( "#pragma warning disable CS0612, CS0618" ) ;
386+ }
387+
388+ [ Test ]
389+ public async Task should_handle_obsolete_attribute_4 ( )
390+ {
391+ var code = await Verify ( new MessageDefinition
392+ {
393+ Name = "FooExecuted" ,
394+ Attributes = { new AttributeDefinition ( "Obsolete" , "\" Custom message\" " ) }
395+ } ) ;
396+
397+ code . ShouldContain ( "#pragma warning disable CS0612, CS0618" ) ;
386398 }
387399
388400 [ Test ]
Original file line number Diff line number Diff line change @@ -138,6 +138,19 @@ public void should_handle_attributes()
138138 msg . Parameters [ 0 ] . Attributes [ 0 ] . TypeName . ShouldEqual ( new TypeName ( "Lol" ) ) ;
139139 }
140140
141+ [ Test ]
142+ public void should_handle_attributes_2 ( )
143+ {
144+ var contracts = ParseValid ( """[Transient(), Obsolete] FooExecuted(int id);""" ) ;
145+
146+ var msg = contracts . Messages . ExpectedSingle ( ) ;
147+ msg . Attributes . Count . ShouldEqual ( 2 ) ;
148+ msg . Attributes [ 0 ] . TypeName . ShouldEqual ( new TypeName ( "Transient" ) ) ;
149+ msg . Attributes [ 0 ] . Parameters . ShouldNotBeNull ( ) . ShouldBeEmpty ( ) ;
150+ msg . Attributes [ 1 ] . TypeName . ShouldEqual ( new TypeName ( "Obsolete" ) ) ;
151+ msg . Attributes [ 1 ] . Parameters . ShouldBeNull ( ) ;
152+ }
153+
141154 [ Test ]
142155 public void should_set_message_as_transient ( )
143156 {
Original file line number Diff line number Diff line change 1+ //------------------------------------------------------------------------------
2+ // <auto-generated>
3+ // This code was generated by a tool.
4+ // </auto-generated>
5+ //------------------------------------------------------------------------------
6+
7+ using System ;
8+ using Abc . Zebus ;
9+ using ProtoBuf ;
10+
11+ #pragma warning disable CS0612 , CS0618
12+
13+ [ ProtoContract ]
14+ [ System . Diagnostics . DebuggerNonUserCode ]
15+ [ System . CodeDom . Compiler . GeneratedCode ( "Abc.Zebus.MessageDsl" , "1.2.3.4" ) ]
16+ [ Obsolete ( "Custom message" ) ]
17+ public sealed partial class FooExecuted : IEvent
18+ {
19+ }
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ private void WritePragmas()
108108
109109 if ( hasObsolete )
110110 {
111- Writer. WriteLine ( "#pragma warning disable 612 " ) ;
111+ Writer. WriteLine ( "#pragma warning disable CS0612, CS0618 " ) ;
112112 Writer. WriteLine ( "" ) ;
113113 }
114114 }
You can’t perform that action at this time.
0 commit comments