2 // Microsoft.VisualBasic.* Test Cases
5 // Gert Driesen (drieseng@users.sourceforge.net)
12 using System.CodeDom.Compiler;
13 using System.Globalization;
15 using Microsoft.VisualBasic;
17 using NUnit.Framework;
19 using MonoTests.System.CodeDom.Compiler;
21 namespace MonoTests.Microsoft.VisualBasic
24 public class CodeGeneratorFromTypeTest_Class : CodeGeneratorFromTypeTestBase
26 private CodeTypeDeclaration _typeDeclaration;
27 private ICodeGenerator _codeGenerator;
29 protected override ICodeGenerator CodeGenerator
31 get { return _codeGenerator; }
34 protected override CodeTypeDeclaration TypeDeclaration
36 get { return _typeDeclaration; }
40 public override void SetUp ()
43 _typeDeclaration = new CodeTypeDeclaration ();
45 CodeDomProvider provider = new VBCodeProvider ();
46 _codeGenerator = provider.CreateGenerator ();
50 public override void DefaultTypeTest ()
52 string code = GenerateDefaultType (Options);
53 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
55 "End Class{0}", NewLine), code);
59 [ExpectedException (typeof (NullReferenceException))]
60 public override void NullTypeTest ()
62 GenerateNullType (Options);
66 public override void SimpleTypeTest ()
68 string code = GenerateSimpleType (Options);
69 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
70 "Public Class Test1{0}" +
71 "End Class{0}", NewLine), code);
75 public override void DerivedTypeTest ()
77 string code = GenerateDerivedType (Options);
78 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
80 "Friend MustInherit Class Test1{0}" +
82 "MustInherit Class Test1{0}" +
84 " Inherits Integer{0}" +
85 " Implements System.Security.Principal.IIdentity, String, System.Security.IPermission{0}" +
86 "End Class{0}", NewLine), code);
90 public override void AttributesAndTypeTest ()
92 string code = GenerateAttributesAndType (Options);
93 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
96 "Public Class Test1{0}" +
97 "End Class{0}", NewLine), code);
101 public override void EventMembersTypeTest1 ()
103 string code = GenerateEventMembersType1 (Options);
104 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
105 "Public Class Test1{0}" +
110 " Private Event __exception As System.Void{0}" +
112 " Private Event As System.Void{0}" +
114 "End Class{0}", NewLine), code);
118 public override void EventMembersTypeTest2 ()
120 string code = GenerateEventMembersType2 (Options);
121 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
122 "Public Class Test1{0}" +
124 " Public Event Click As Integer{0}" +
125 "End Class{0}", NewLine), code);
129 public override void EventImplementationTypes ()
131 string code = GenerateEventImplementationTypes (Options);
132 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
133 "Public Class Test1{0}" +
136 " Friend Event Click As Integer Implements IPolicy.Click , IWhatever.Click{0}" +
138 " Friend Event Click As Integer{0}" +
140 "End Class{0}", NewLine), code);
144 /// Ensure no access modifiers are output if PrivateImplementationType
148 public override void EventPrivateImplementationType ()
150 string code = GenerateEventPrivateImplementationType (Options);
151 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
152 "Public Class Test1{0}" +
155 " Protected Event System_Int32_Click As Integer Implements Integer.Click{0}" +
157 " Protected Event Click As Integer{0}" +
159 "End Class{0}", NewLine), code);
163 /// If both ImplementationTypes and PrivateImplementationType are set,
164 /// then only ImplementationTypes are output.
167 public override void EventImplementationTypeOrder ()
169 string code = GenerateEventImplementationTypeOrder (Options);
170 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
171 "Public Class Test1{0}" +
174 " Public Event System_Int32_Click As Integer Implements IPolicy.Click{0}" +
176 " Public Event Click As Integer{0}" +
178 "End Class{0}", NewLine), code);
182 public override void FieldMembersAttributesTest ()
184 string code = GenerateFieldMembersAttributes (Options);
185 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
186 "Public Class Test1{0}" +
191 " Private __exception As System.Void{0}" +
193 " Private As System.Void{0}" +
195 "End Class{0}", NewLine), code);
199 public override void FieldMembersTypeTest ()
201 string code = GenerateFieldMembersType (MemberAttributes.Public, Options);
202 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
203 "Public Class Test1{0}" +
205 " Public Name As Integer = 2{0}" +
206 "End Class{0}", NewLine), code);
210 public override void FieldNewSlotTest ()
212 string code = GenerateFieldMembersType (MemberAttributes.Assembly |
213 MemberAttributes.New, Options);
214 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
215 "Public Class Test1{0}" +
217 " Friend Shadows Name As Integer = 2{0}" +
218 "End Class{0}", NewLine), code);
222 public override void PropertyMembersTypeTest1 ()
224 string code = GeneratePropertyMembersAttributes (Options);
225 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
226 "Public Class Test1{0}" +
231 " Private Property () As System.Void{0}" +
233 " Private Property As System.Void{0}" +
236 "End Class{0}", NewLine), code);
240 public override void PropertyMembersTypeTest2 ()
242 string code = GeneratePropertyMembersType (MemberAttributes.Public,
243 false, false, Options);
244 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
245 "Public Class Test1{0}" +
248 " Public Overridable Property Name() As Integer{0}" +
250 " Public Overridable Property Name As Integer{0}" +
253 "End Class{0}", NewLine), code);
257 public override void PropertyMembersTypeGetOnly ()
259 string code = GeneratePropertyMembersType (MemberAttributes.Family,
260 true, false, Options);
261 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
262 "Public Class Test1{0}" +
265 " Protected Overridable ReadOnly Property Name() As Integer{0}" +
267 " Protected Overridable ReadOnly Property Name As Integer{0}" +
272 "End Class{0}", NewLine), code);
276 public override void PropertyMembersTypeSetOnly ()
278 string code = GeneratePropertyMembersType (MemberAttributes.Assembly,
279 false, true, Options);
280 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
281 "Public Class Test1{0}" +
284 " Friend Overridable WriteOnly Property Name() As Integer{0}" +
286 " Friend WriteOnly Property Name As Integer{0}" +
291 "End Class{0}", NewLine), code);
295 public override void PropertyMembersTypeGetSet ()
297 string code = GeneratePropertyMembersType (MemberAttributes.Family,
298 true, true, Options);
299 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
300 "Public Class Test1{0}" +
303 " Protected Overridable Property Name() As Integer{0}" +
305 " Protected Overridable Property Name As Integer{0}" +
312 "End Class{0}", NewLine), code);
316 // A bug in MS.NET 1.x causes MemberAttributes.FamilyOrAssembly to be
317 // generated as Protected
318 [Category ("NotDotNet")]
321 public override void PropertyMembersTypeFamilyOrAssembly ()
323 string code = GeneratePropertyMembersType (MemberAttributes.FamilyOrAssembly,
324 false, false, Options);
325 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
326 "Public Class Test1{0}" +
329 " Protected Friend Property Name() As Integer{0}" +
331 " Protected Friend Property Name As Integer{0}" +
334 "End Class{0}", NewLine), code);
338 // A bug in MS.NET 1.x causes MemberAttributes.Assembly to be generated
340 [Category ("NotDotNet")]
343 public override void PropertyMembersTypeAssembly ()
345 string code = GeneratePropertyMembersType (MemberAttributes.Assembly,
346 false, false, Options);
347 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
348 "Public Class Test1{0}" +
351 " Friend Overridable Property Name() As Integer{0}" +
353 " Friend Property Name As Integer{0}" +
356 "End Class{0}", NewLine), code);
360 /// Apparently VB.NET CodeDOM also allows properties that aren't indexers
361 /// to have parameters.
364 public override void PropertyParametersTest ()
366 string code = GeneratePropertyParameters (Options);
367 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
368 "Public Class Test1{0}" +
370 " Public Overridable Property Name(ByVal value1 As Object, ByRef value2 As Integer) As Integer{0}" +
372 "End Class{0}", NewLine), code);
376 public override void PropertyIndexerTest1 ()
378 string code = GeneratePropertyIndexer (MemberAttributes.Public,
379 false, false, true, Options);
380 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
381 "Public Class Test1{0}" +
383 " Public Overridable Default Property iTem(ByVal value1 As Object, ByRef value2 As Integer) As Integer{0}" +
385 "End Class{0}", NewLine), code);
389 /// Ensures Default keyword is only output if property is named "Item"
390 /// (case-insensitive comparison) AND parameters are defined.
393 public override void PropertyIndexerTest2 ()
395 string code = GeneratePropertyIndexer (MemberAttributes.Public,
396 false, false, false, Options);
397 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
398 "Public Class Test1{0}" +
401 " Public Overridable Property iTem() As Integer{0}" +
403 " Public Overridable Property iTem As Integer{0}" +
406 "End Class{0}", NewLine), code);
410 /// Ensures Default keyword is output after ReadOnly modifier.
413 public override void PropertyIndexerGetOnly ()
415 string code = GeneratePropertyIndexer (MemberAttributes.Family,
416 true, false, true, Options);
417 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
418 "Public Class Test1{0}" +
420 " Protected Overridable Default ReadOnly Property iTem(ByVal value1 As Object, ByRef value2 As Integer) As Integer{0}" +
424 "End Class{0}", NewLine), code);
428 /// Ensures Default keyword is output after WriteOnly modifier.
431 public override void PropertyIndexerSetOnly ()
433 string code = GeneratePropertyIndexer (MemberAttributes.Family,
434 false, true, true, Options);
435 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
436 "Public Class Test1{0}" +
438 " Protected Overridable Default WriteOnly Property iTem(ByVal value1 As Object, ByRef value2 As Integer) As Integer{0}" +
442 "End Class{0}", NewLine), code);
446 public override void PropertyImplementationTypes ()
448 string code = GeneratePropertyImplementationTypes (Options);
449 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
450 "Public Class Test1{0}" +
453 " Public Overridable Property Name() As Integer Implements IPolicy.Name , IWhatever.Name{0}" +
455 " Public Overridable Property Name As Integer Implements IPolicy.Name , IWhatever.Name{0}" +
458 "End Class{0}", NewLine), code);
462 /// Ensure that Overloads keyword is output for a property which has
463 /// explicitly been marked as Overloaded.
466 public override void PropertyOverloadsTest1 ()
468 string code = GeneratePropertyOverloads1 (Options);
469 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
470 "Public Class Test1{0}" +
473 " Protected Overloads Overridable Property Name() As Integer{0}" +
475 " Protected Overloads Overridable Property Name As Integer{0}" +
478 "End Class{0}", NewLine), code);
482 /// Ensure that Overloads keyword is output if multiple properties with
483 /// the same name are defined.
486 public override void PropertyOverloadsTest2 ()
488 string code = GeneratePropertyOverloads2 (Options);
489 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
490 "Public Class Test1{0}" +
493 " Public Overloads Overridable Property Name() As Integer{0}" +
495 " Public Overloads Overridable Property Name As Integer{0}" +
499 " Private Overloads Property Name(ByVal value1 As Object) As Integer{0}" +
501 "End Class{0}", NewLine), code);
505 /// Ensure that a property with a PrivateImplementationType and with
506 /// the same name does not qualify as an overload.
509 public override void PropertyOverloadsTest3 ()
511 string code = GeneratePropertyOverloads3 (Options);
512 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
513 "Public Class Test1{0}" +
516 " Public Overridable Property Name() As Integer{0}" +
518 " Public Overridable Property Name As Integer{0}" +
522 " Property System_Int32_Name(ByVal value1 As Object) As Integer Implements Integer.Name{0}" +
524 "End Class{0}", NewLine), code);
528 /// Ensure no access modifiers are output if PrivateImplementationType
529 /// is set. Default keyword is also not output in this case.
532 public override void PropertyPrivateImplementationType ()
534 string code = GeneratePropertyPrivateImplementationType (Options);
535 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
536 "Public Class Test1{0}" +
538 " Overridable Property System_Int32_Item(ByVal value1 As Object) As Integer Implements Integer.Item{0}" +
540 "End Class{0}", NewLine), code);
544 /// If both ImplementationTypes and PrivateImplementationType are set,
545 /// then only ImplementationTypes are output.
548 public override void PropertyImplementationTypeOrder ()
550 string code = GeneratePropertyImplementationTypeOrder (Options);
551 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
552 "Public Class Test1{0}" +
554 " Overridable Property System_Int32_Item(ByVal value1 As Object) As Integer Implements IPolicy.Item{0}" +
556 "End Class{0}", NewLine), code);
560 public override void PropertyNewSlotTest ()
562 string code = GeneratePropertyMembersType (MemberAttributes.Private |
563 MemberAttributes.New, true, true, Options);
564 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
565 "Public Class Test1{0}" +
568 " Private Shadows Property Name() As Integer{0}" +
570 " Private Shadows Property Name As Integer{0}" +
577 "End Class{0}", NewLine), code);
581 public override void MethodMembersTypeTest1 ()
583 string code = GenerateMethodMembersType1 (Options);
584 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
585 "Public Class Test1{0}" +
589 " Private Sub (){0}" +
591 "End Class{0}", NewLine), code);
595 public override void MethodMembersTypeTest2 ()
597 string code = GenerateMethodMembersType2 (Options);
598 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
599 "Public Class Test1{0}" +
601 " Public Overridable Function Something(ByVal value1 As Object, ByVal value2 As Object, ByRef index As Integer, ByRef count As Integer) As Integer{0}" +
603 "End Class{0}", NewLine), code);
607 public override void MethodMembersTypeTest3 ()
609 string code = GenerateMethodMembersType3 (Options);
610 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
611 "Public Class Test1{0}" +
614 " Public Overridable Function Something(<A(), B()> ByVal value As Object, <C(A1:=false, A2:=true), D()> ByRef __exception As Integer) As Integer{0}" +
616 " Public Overridable Function Something(<A(), B()> ByVal value As Object, <C(A1:=false, A2:=true), D()> ByRef As Integer) As Integer{0}" +
619 "End Class{0}", NewLine), code);
623 public override void MethodImplementationTypes ()
625 string code = GenerateMethodImplementationTypes (Options);
626 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
627 "Public Class Test1{0}" +
630 " Friend Overridable Function Execute() As Integer Implements IPolicy.Execute , IWhatever.Execute{0}" +
632 " Friend Function Execute() As Integer Implements IPolicy.Execute , IWhatever.Execute{0}" +
635 "End Class{0}", NewLine), code);
639 /// Ensure that Overloads keyword is output for a method which has
640 /// explicitly been marked as Overloaded.
643 public override void MethodOverloadsTest1 ()
645 string code = GenerateMethodOverloads1 (Options);
646 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
647 "Public Class Test1{0}" +
650 " Friend Overloads Overridable Function Execute() As Integer{0}" +
652 " Friend Overloads Function Execute() As Integer{0}" +
655 "End Class{0}", NewLine), code);
659 /// Ensure that Overloads keyword is output if multiple methods with
660 /// the same name are defined.
663 public override void MethodOverloadsTest2 ()
665 string code = GenerateMethodOverloads2 (Options);
666 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
667 "Public Class Test1{0}" +
669 " Public Overloads Overridable Sub Execute(){0}" +
672 " Private Overloads Function Execute(ByVal value1 As Object) As Integer{0}" +
674 "End Class{0}", NewLine), code);
678 /// Ensure that a method with a PrivateImplementationType and with
679 /// the same name does not qualify as an overload.
682 public override void MethodOverloadsTest3 ()
684 string code = GenerateMethodOverloads3 (Options);
685 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
686 "Public Class Test1{0}" +
688 " Public Overridable Sub Execute(){0}" +
691 " Function System_Int32_Execute(ByVal value1 As Object) As Integer Implements Integer.Execute{0}" +
693 "End Class{0}", NewLine), code);
697 /// Ensure no access modifiers are output if PrivateImplementationType
701 public override void MethodPrivateImplementationType ()
703 string code = GenerateMethodPrivateImplementationType (Options);
704 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
705 "Public Class Test1{0}" +
707 " Overridable Function System_Int32_Execute(ByVal value1 As Object) As Integer Implements Integer.Execute{0}" +
709 "End Class{0}", NewLine), code);
713 /// If both ImplementationTypes and PrivateImplementationType are set,
714 /// then only ImplementationTypes are output.
717 public override void MethodImplementationTypeOrder ()
719 string code = GenerateMethodImplementationTypeOrder (Options);
720 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
721 "Public Class Test1{0}" +
723 " Overridable Function System_Int32_Execute(ByVal value1 As Object) As Integer Implements IPolicy.Execute{0}" +
725 "End Class{0}", NewLine), code);
729 public override void MethodReturnTypeAttributes ()
731 string code = GenerateMethodReturnTypeAttributes (Options);
732 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
733 "Public Class Test1{0}" +
737 " Public Overridable Function Execute() As <C(A1:=false, A2:=true), D()> Integer{0}" +
739 "End Class{0}", NewLine), code);
743 public override void MethodNewSlotTest ()
745 string code = GenerateMethodNewSlot (Options);
746 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
747 "Public Class Test1{0}" +
749 " Public Shadows Overridable Function Execute() As Integer{0}" +
751 "End Class{0}", NewLine), code);
755 public override void ConstructorAttributesTest ()
757 // FIXME: updated to reflect mbas workaround
758 string code = GenerateConstructorAttributes (Options);
759 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
760 "Public Class Test1{0}" +
764 " Private Sub New(){0}" +
767 "End Class{0}", NewLine), code);
771 public override void ConstructorParametersTest ()
773 // FIXME: updated to reflect mbas workaround
774 string code = GenerateConstructorParameters (Options);
775 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
776 "Public Class Test1{0}" +
778 " Public Sub New(ByVal value1 As Object, ByVal value2 As Object, ByRef index As Integer, ByRef count As Integer){0}" +
781 "End Class{0}", NewLine), code);
785 public override void ConstructorParameterAttributesTest ()
787 // FIXME: updated to reflect mbas workaround
788 string code = GenerateConstructorParameterAttributes (Options);
789 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
790 "Public Class Test1{0}" +
792 " Private Sub New(<A(), B()> ByVal value As Object, <C(A1:=false, A2:=true), D()> ByRef index As Integer){0}" +
795 "End Class{0}", NewLine), code);
799 public override void BaseConstructorSingleArg ()
801 string code = GenerateBaseConstructor (false, Options);
802 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
803 "Public Class Test1{0}" +
805 " Protected Sub New(ByVal value1 As Object, ByRef value2 As Integer){0}" +
806 " MyBase.New(value1){0}" +
808 "End Class{0}", NewLine), code);
812 public override void BaseConstructorMultipleArgs ()
814 string code = GenerateBaseConstructor (true, Options);
815 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
816 "Public Class Test1{0}" +
818 " Protected Sub New(ByVal value1 As Object, ByRef value2 As Integer){0}" +
819 " MyBase.New(value1, value2){0}" +
821 "End Class{0}", NewLine), code);
825 public override void ChainedConstructorSingleArg ()
827 string code = GenerateChainedConstructor (false, Options);
828 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
829 "Public Class Test1{0}" +
831 " Public Sub New(ByVal value1 As Object, ByRef value2 As Integer){0}" +
832 " Me.New(value1){0}" +
834 "End Class{0}", NewLine), code);
838 public override void ChainedConstructorMultipleArgs ()
840 string code = GenerateChainedConstructor (true, Options);
841 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
842 "Public Class Test1{0}" +
844 " Public Sub New(ByVal value1 As Object, ByRef value2 As Integer){0}" +
845 " Me.New(value1, value2){0}" +
847 "End Class{0}", NewLine), code);
851 public override void TypeConstructorTest ()
853 string code = GenerateTypeConstructor (Options);
854 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
855 "Public Class Test1{0}" +
861 " Shared Sub New(){0}" +
863 "End Class{0}", NewLine), code);
867 public override void EntryPointMethodTest ()
869 string code = GenerateEntryPointMethod (Options);
870 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
871 "Public Class Test1{0}" +
876 " Public Shared Sub Main(){0}" +
877 " Dim x As Test.InnerType{0}" +
879 "End Class{0}", NewLine), code);
884 public class CodeGeneratorFromTypeTest_Delegate : CodeGeneratorFromTypeTestBase
886 private CodeTypeDeclaration _typeDeclaration;
887 private ICodeGenerator _codeGenerator;
889 protected override ICodeGenerator CodeGenerator
891 get { return _codeGenerator; }
894 protected override CodeTypeDeclaration TypeDeclaration
896 get { return _typeDeclaration; }
900 public override void SetUp ()
903 _typeDeclaration = new CodeTypeDelegate ();
905 CodeDomProvider provider = new VBCodeProvider ();
906 _codeGenerator = provider.CreateGenerator ();
910 public override void DefaultTypeTest ()
912 string code = GenerateDefaultType (Options);
913 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
914 "Public Delegate Sub (){0}", NewLine), code);
918 [ExpectedException (typeof (NullReferenceException))]
919 public override void NullTypeTest ()
921 GenerateNullType (Options);
925 public override void SimpleTypeTest ()
927 string code = GenerateSimpleType (Options);
928 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
929 "Public Delegate Sub Test1(){0}", NewLine), code);
933 public override void DerivedTypeTest ()
935 string code = GenerateDerivedType (Options);
936 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
937 "Delegate Sub Test1(){0}", NewLine), code);
941 public override void AttributesAndTypeTest ()
943 CodeTypeDelegate delegateDecl = new CodeTypeDelegate ();
944 delegateDecl.ReturnType = new CodeTypeReference (typeof (int));
946 _typeDeclaration = delegateDecl;
948 string code = GenerateAttributesAndType (Options);
949 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
952 "Public Delegate Function Test1() As Integer{0}", NewLine), code);
956 public override void EventMembersTypeTest1 ()
958 string code = GenerateEventMembersType1 (Options);
959 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
960 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
964 public override void EventMembersTypeTest2 ()
966 string code = GenerateEventMembersType2 (Options);
967 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
968 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
972 public override void EventImplementationTypes ()
974 string code = GenerateEventImplementationTypes (Options);
975 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
976 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
980 /// Ensure no access modifiers are output if PrivateImplementationType
984 public override void EventPrivateImplementationType ()
986 string code = GenerateEventPrivateImplementationType (Options);
987 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
988 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
992 /// If both ImplementationTypes and PrivateImplementationType are set,
993 /// then only ImplementationTypes are output.
996 public override void EventImplementationTypeOrder ()
998 string code = GenerateEventImplementationTypeOrder (Options);
999 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1000 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1004 public override void FieldMembersAttributesTest ()
1006 string code = GenerateFieldMembersAttributes (Options);
1007 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1008 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1012 public override void FieldMembersTypeTest ()
1014 string code = GenerateFieldMembersType (MemberAttributes.Public, Options);
1015 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1016 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1020 public override void FieldNewSlotTest ()
1022 string code = GenerateFieldMembersType (MemberAttributes.Assembly |
1023 MemberAttributes.New, Options);
1024 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1025 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1029 public override void PropertyMembersTypeTest1 ()
1031 string code = GeneratePropertyMembersAttributes (Options);
1032 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1033 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1037 public override void PropertyMembersTypeTest2 ()
1039 string code = GeneratePropertyMembersType (MemberAttributes.Public,
1040 false, false, Options);
1041 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1042 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1046 public override void PropertyMembersTypeGetOnly ()
1048 string code = GeneratePropertyMembersType (MemberAttributes.Family,
1049 true, false, Options);
1050 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1051 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1055 public override void PropertyMembersTypeSetOnly ()
1057 string code = GeneratePropertyMembersType (MemberAttributes.Assembly,
1058 false, true, Options);
1059 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1060 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1064 public override void PropertyMembersTypeGetSet ()
1066 string code = GeneratePropertyMembersType (MemberAttributes.Family,
1067 true, true, Options);
1068 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1069 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1073 public override void PropertyMembersTypeFamilyOrAssembly ()
1075 string code = GeneratePropertyMembersType (MemberAttributes.FamilyOrAssembly,
1076 false, false, Options);
1077 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1078 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1082 public override void PropertyMembersTypeAssembly ()
1084 string code = GeneratePropertyMembersType (MemberAttributes.Assembly,
1085 false, false, Options);
1086 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1087 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1091 public override void PropertyParametersTest ()
1093 string code = GeneratePropertyParameters (Options);
1094 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1095 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1099 public override void PropertyIndexerTest1 ()
1101 string code = GeneratePropertyIndexer (MemberAttributes.Public,
1102 false, false, true, Options);
1103 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1104 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1108 public override void PropertyIndexerTest2 ()
1110 string code = GeneratePropertyIndexer (MemberAttributes.Public,
1111 false, false, false, Options);
1112 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1113 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1117 public override void PropertyIndexerGetOnly ()
1119 string code = GeneratePropertyIndexer (MemberAttributes.Family,
1120 true, false, true, Options);
1121 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1122 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1126 public override void PropertyIndexerSetOnly ()
1128 string code = GeneratePropertyIndexer (MemberAttributes.Family,
1129 false, true, true, Options);
1130 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1131 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1135 public override void PropertyImplementationTypes ()
1137 string code = GeneratePropertyImplementationTypes (Options);
1138 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1139 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1143 public override void PropertyOverloadsTest1 ()
1145 string code = GeneratePropertyOverloads1 (Options);
1146 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1147 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1151 public override void PropertyOverloadsTest2 ()
1153 string code = GeneratePropertyOverloads2 (Options);
1154 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1155 "Public Delegate Sub Test1(){0}{0}{0}", NewLine), code);
1159 public override void PropertyOverloadsTest3 ()
1161 string code = GeneratePropertyOverloads3 (Options);
1162 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1163 "Public Delegate Sub Test1(){0}{0}{0}", NewLine), code);
1167 public override void PropertyPrivateImplementationType ()
1169 string code = GeneratePropertyPrivateImplementationType (Options);
1170 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1171 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1175 public override void PropertyImplementationTypeOrder ()
1177 string code = GeneratePropertyImplementationTypeOrder (Options);
1178 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1179 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1183 public override void PropertyNewSlotTest ()
1185 string code = GeneratePropertyMembersType (MemberAttributes.Private |
1186 MemberAttributes.New, true, true, Options);
1187 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1188 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1192 public override void MethodMembersTypeTest1 ()
1194 string code = GenerateMethodMembersType1 (Options);
1195 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1196 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1200 public override void MethodMembersTypeTest2 ()
1202 string code = GenerateMethodMembersType2 (Options);
1203 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1204 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1208 public override void MethodMembersTypeTest3 ()
1210 string code = GenerateMethodMembersType3 (Options);
1211 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1212 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1216 public override void MethodImplementationTypes ()
1218 string code = GenerateMethodImplementationTypes (Options);
1219 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1220 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1224 public override void MethodOverloadsTest1 ()
1226 string code = GenerateMethodOverloads1 (Options);
1227 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1228 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1232 public override void MethodOverloadsTest2 ()
1234 string code = GenerateMethodOverloads2 (Options);
1235 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1236 "Public Delegate Sub Test1(){0}{0}{0}", NewLine), code);
1240 public override void MethodOverloadsTest3 ()
1242 string code = GenerateMethodOverloads3 (Options);
1243 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1244 "Public Delegate Sub Test1(){0}{0}{0}", NewLine), code);
1248 public override void MethodPrivateImplementationType ()
1250 string code = GenerateMethodPrivateImplementationType (Options);
1251 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1252 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1256 public override void MethodImplementationTypeOrder ()
1258 string code = GenerateMethodImplementationTypeOrder (Options);
1259 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1260 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1264 public override void MethodReturnTypeAttributes ()
1266 string code = GenerateMethodReturnTypeAttributes (Options);
1267 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1268 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1272 public override void MethodNewSlotTest ()
1274 string code = GenerateMethodNewSlot (Options);
1275 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1276 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1280 public override void ConstructorAttributesTest ()
1282 string code = GenerateConstructorAttributes (Options);
1283 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1284 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1288 public override void ConstructorParametersTest ()
1290 string code = GenerateConstructorParameters (Options);
1291 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1292 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1296 public override void ConstructorParameterAttributesTest ()
1298 string code = GenerateConstructorParameterAttributes (Options);
1299 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1300 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1304 public override void BaseConstructorSingleArg ()
1306 string code = GenerateBaseConstructor (false, Options);
1307 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1308 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1312 public override void BaseConstructorMultipleArgs ()
1314 string code = GenerateBaseConstructor (true, Options);
1315 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1316 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1320 public override void ChainedConstructorSingleArg ()
1322 string code = GenerateChainedConstructor (false, Options);
1323 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1324 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1328 public override void ChainedConstructorMultipleArgs ()
1330 string code = GenerateChainedConstructor (true, Options);
1331 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1332 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1336 public override void TypeConstructorTest ()
1338 string code = GenerateTypeConstructor (Options);
1339 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1340 "Public Delegate Sub Test1(){0}{0}", NewLine), code);
1344 public override void EntryPointMethodTest ()
1346 string code = GenerateEntryPointMethod (Options);
1347 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1348 "Public Delegate Sub Test1(){0}{0}" +
1352 "Public Shared Sub Main(){0}" +
1353 " Dim x As Test.InnerType{0}" +
1354 "End Sub{0}", NewLine), code);
1358 public void DelegateWithParametersTest ()
1360 CodeTypeDelegate type = new CodeTypeDelegate("A");
1361 type.Parameters.Add (new CodeParameterDeclarationExpression ("type", "param"));
1363 string code = GenerateCodeFromType (type, Options);
1364 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1365 "Public Delegate Sub A(ByVal param As type){0}", NewLine), code);
1370 public class CodeGeneratorFromTypeTest_Interface : CodeGeneratorFromTypeTestBase
1372 private CodeTypeDeclaration _typeDeclaration;
1373 private ICodeGenerator _codeGenerator;
1375 protected override ICodeGenerator CodeGenerator
1377 get { return _codeGenerator; }
1380 protected override CodeTypeDeclaration TypeDeclaration
1382 get { return _typeDeclaration; }
1386 public override void SetUp ()
1389 _typeDeclaration = new CodeTypeDeclaration ();
1390 _typeDeclaration.IsInterface = true;
1392 CodeDomProvider provider = new VBCodeProvider ();
1393 _codeGenerator = provider.CreateGenerator ();
1397 public override void DefaultTypeTest ()
1399 string code = GenerateDefaultType (Options);
1400 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1401 "Public Interface {0}" +
1402 "End Interface{0}", NewLine), code);
1406 [ExpectedException (typeof (NullReferenceException))]
1407 public override void NullTypeTest ()
1409 GenerateNullType (Options);
1413 public override void SimpleTypeTest ()
1415 string code = GenerateSimpleType (Options);
1416 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1417 "Public Interface Test1{0}" +
1418 "End Interface{0}", NewLine), code);
1422 public override void DerivedTypeTest ()
1424 string code = GenerateDerivedType (Options);
1425 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1427 "Friend Interface Test1{0}" +
1429 "Interface Test1{0}" +
1431 " Inherits Integer, System.Security.Principal.IIdentity, String, System.Security.IPermission{0}" +
1432 "End Interface{0}", NewLine), code);
1436 public override void AttributesAndTypeTest ()
1438 string code = GenerateAttributesAndType (Options);
1439 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1442 "Public Interface Test1{0}" +
1443 "End Interface{0}", NewLine), code);
1447 public override void EventMembersTypeTest1 ()
1449 string code = GenerateEventMembersType1 (Options);
1450 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1451 "Public Interface Test1{0}" +
1456 " Private Event __exception As System.Void{0}" +
1458 " Private Event As System.Void{0}" +
1460 "End Interface{0}", NewLine), code);
1464 public override void EventMembersTypeTest2 ()
1466 string code = GenerateEventMembersType2 (Options);
1467 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1468 "Public Interface Test1{0}" +
1470 " Public Event Click As Integer{0}" +
1471 "End Interface{0}", NewLine), code);
1475 public override void EventImplementationTypes ()
1477 string code = GenerateEventImplementationTypes (Options);
1478 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1479 "Public Interface Test1{0}" +
1482 " Friend Event Click As Integer Implements IPolicy.Click , IWhatever.Click{0}" +
1484 " Friend Event Click As Integer{0}" +
1486 "End Interface{0}", NewLine), code);
1490 public override void EventPrivateImplementationType ()
1492 string code = GenerateEventPrivateImplementationType (Options);
1493 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1494 "Public Interface Test1{0}" +
1497 " Protected Event System_Int32_Click As Integer Implements Integer.Click{0}" +
1499 " Protected Event Click As Integer{0}" +
1501 "End Interface{0}", NewLine), code);
1505 public override void EventImplementationTypeOrder ()
1507 string code = GenerateEventImplementationTypeOrder (Options);
1508 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1509 "Public Interface Test1{0}" +
1512 " Public Event System_Int32_Click As Integer Implements IPolicy.Click{0}" +
1514 " Public Event Click As Integer{0}" +
1516 "End Interface{0}", NewLine), code);
1520 public override void FieldMembersAttributesTest ()
1522 string code = GenerateFieldMembersAttributes (Options);
1523 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1524 "Public Interface Test1{0}" +
1526 "End Interface{0}", NewLine), code);
1530 public override void FieldMembersTypeTest ()
1532 string code = GenerateFieldMembersType (MemberAttributes.Public, Options);
1533 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1534 "Public Interface Test1{0}" +
1536 "End Interface{0}", NewLine), code);
1540 public override void FieldNewSlotTest ()
1542 string code = GenerateFieldMembersType (MemberAttributes.Assembly |
1543 MemberAttributes.New, Options);
1544 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1545 "Public Interface Test1{0}" +
1547 "End Interface{0}", NewLine), code);
1551 public override void PropertyMembersTypeTest1 ()
1553 string code = GeneratePropertyMembersAttributes (Options);
1554 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1555 "Public Interface Test1{0}" +
1560 " Property () As System.Void{0}" +
1562 " Property As System.Void{0}" +
1564 "End Interface{0}", NewLine), code);
1568 public override void PropertyMembersTypeTest2 ()
1570 string code = GeneratePropertyMembersType (MemberAttributes.Public,
1571 false, false, Options);
1572 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1573 "Public Interface Test1{0}" +
1576 " Property Name() As Integer{0}" +
1578 " Property Name As Integer{0}" +
1580 "End Interface{0}", NewLine), code);
1584 public override void PropertyMembersTypeGetOnly ()
1586 string code = GeneratePropertyMembersType (MemberAttributes.Family,
1587 true, false, Options);
1588 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1589 "Public Interface Test1{0}" +
1592 " ReadOnly Property Name() As Integer{0}" +
1594 " ReadOnly Property Name As Integer{0}" +
1596 "End Interface{0}", NewLine), code);
1600 public override void PropertyMembersTypeSetOnly ()
1602 string code = GeneratePropertyMembersType (MemberAttributes.Assembly,
1603 false, true, Options);
1604 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1605 "Public Interface Test1{0}" +
1608 " WriteOnly Property Name() As Integer{0}" +
1610 " WriteOnly Property Name As Integer{0}" +
1612 "End Interface{0}", NewLine), code);
1616 public override void PropertyMembersTypeGetSet ()
1618 string code = GeneratePropertyMembersType (MemberAttributes.Family,
1619 true, true, Options);
1620 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1621 "Public Interface Test1{0}" +
1624 " Property Name() As Integer{0}" +
1626 " Property Name As Integer{0}" +
1628 "End Interface{0}", NewLine), code);
1632 public override void PropertyMembersTypeFamilyOrAssembly ()
1634 string code = GeneratePropertyMembersType (MemberAttributes.FamilyOrAssembly,
1635 false, false, Options);
1636 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1637 "Public Interface Test1{0}" +
1640 " Property Name() As Integer{0}" +
1642 " Property Name As Integer{0}" +
1644 "End Interface{0}", NewLine), code);
1648 public override void PropertyMembersTypeAssembly ()
1650 string code = GeneratePropertyMembersType (MemberAttributes.Assembly,
1651 false, false, Options);
1652 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1653 "Public Interface Test1{0}" +
1656 " Property Name() As Integer{0}" +
1658 " Property Name As Integer{0}" +
1660 "End Interface{0}", NewLine), code);
1664 public override void PropertyParametersTest ()
1666 string code = GeneratePropertyParameters (Options);
1667 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1668 "Public Interface Test1{0}" +
1670 " Property Name(ByVal value1 As Object, ByRef value2 As Integer) As Integer{0}" +
1671 "End Interface{0}", NewLine), code);
1675 public override void PropertyIndexerTest1 ()
1677 string code = GeneratePropertyIndexer (MemberAttributes.Public,
1678 false, false, true, Options);
1679 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1680 "Public Interface Test1{0}" +
1682 " Default Property iTem(ByVal value1 As Object, ByRef value2 As Integer) As Integer{0}" +
1683 "End Interface{0}", NewLine), code);
1687 public override void PropertyIndexerTest2 ()
1689 string code = GeneratePropertyIndexer (MemberAttributes.Public,
1690 false, false, false, Options);
1691 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1692 "Public Interface Test1{0}" +
1695 " Property iTem() As Integer{0}" +
1697 " Property iTem As Integer{0}" +
1699 "End Interface{0}", NewLine), code);
1703 public override void PropertyIndexerGetOnly ()
1705 string code = GeneratePropertyIndexer (MemberAttributes.Family,
1706 true, false, true, Options);
1707 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1708 "Public Interface Test1{0}" +
1710 " Default ReadOnly Property iTem(ByVal value1 As Object, ByRef value2 As Integer) As Integer{0}" +
1711 "End Interface{0}", NewLine), code);
1715 public override void PropertyIndexerSetOnly ()
1717 string code = GeneratePropertyIndexer (MemberAttributes.Family,
1718 false, true, true, Options);
1719 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1720 "Public Interface Test1{0}" +
1722 " Default WriteOnly Property iTem(ByVal value1 As Object, ByRef value2 As Integer) As Integer{0}" +
1723 "End Interface{0}", NewLine), code);
1727 public override void PropertyImplementationTypes ()
1729 string code = GeneratePropertyImplementationTypes (Options);
1730 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1731 "Public Interface Test1{0}" +
1734 " Property Name() As Integer Implements IPolicy.Name , IWhatever.Name{0}" +
1736 " Property Name As Integer Implements IPolicy.Name , IWhatever.Name{0}" +
1738 "End Interface{0}", NewLine), code);
1742 public override void PropertyOverloadsTest1 ()
1744 string code = GeneratePropertyOverloads1 (Options);
1745 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1746 "Public Interface Test1{0}" +
1749 " Property Name() As Integer{0}" +
1751 " Property Name As Integer{0}" +
1753 "End Interface{0}", NewLine), code);
1757 public override void PropertyOverloadsTest2 ()
1759 string code = GeneratePropertyOverloads2 (Options);
1760 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1761 "Public Interface Test1{0}" +
1764 " Property Name() As Integer{0}" +
1766 " Property Name As Integer{0}" +
1769 " Property Name(ByVal value1 As Object) As Integer{0}" +
1770 "End Interface{0}", NewLine), code);
1774 public override void PropertyOverloadsTest3 ()
1776 string code = GeneratePropertyOverloads3 (Options);
1777 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1778 "Public Interface Test1{0}" +
1781 " Property Name() As Integer{0}" +
1783 " Property Name As Integer{0}" +
1786 " Property System_Int32_Name(ByVal value1 As Object) As Integer Implements Integer.Name{0}" +
1787 "End Interface{0}", NewLine), code);
1791 public override void PropertyPrivateImplementationType ()
1793 string code = GeneratePropertyPrivateImplementationType (Options);
1794 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1795 "Public Interface Test1{0}" +
1797 " Property System_Int32_Item(ByVal value1 As Object) As Integer Implements Integer.Item{0}" +
1798 "End Interface{0}", NewLine), code);
1802 public override void PropertyImplementationTypeOrder ()
1804 string code = GeneratePropertyImplementationTypeOrder (Options);
1805 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1806 "Public Interface Test1{0}" +
1808 " Property System_Int32_Item(ByVal value1 As Object) As Integer Implements IPolicy.Item{0}" +
1809 "End Interface{0}", NewLine), code);
1813 public override void PropertyNewSlotTest ()
1815 string code = GeneratePropertyMembersType (MemberAttributes.Private |
1816 MemberAttributes.New, true, true, Options);
1817 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1818 "Public Interface Test1{0}" +
1821 " Shadows Property Name() As Integer{0}" +
1823 " Shadows Property Name As Integer{0}" +
1825 "End Interface{0}", NewLine), code);
1829 public override void MethodMembersTypeTest1 ()
1831 string code = GenerateMethodMembersType1 (Options);
1832 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1833 "Public Interface Test1{0}" +
1838 "End Interface{0}", NewLine), code);
1842 public override void MethodMembersTypeTest2 ()
1844 string code = GenerateMethodMembersType2 (Options);
1845 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1846 "Public Interface Test1{0}" +
1848 " Function Something(ByVal value1 As Object, ByVal value2 As Object, ByRef index As Integer, ByRef count As Integer) As Integer{0}" +
1849 "End Interface{0}", NewLine), code);
1853 public override void MethodMembersTypeTest3 ()
1855 string code = GenerateMethodMembersType3 (Options);
1856 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1857 "Public Interface Test1{0}" +
1860 " Function Something(<A(), B()> ByVal value As Object, <C(A1:=false, A2:=true), D()> ByRef __exception As Integer) As Integer{0}" +
1862 " Function Something(<A(), B()> ByVal value As Object, <C(A1:=false, A2:=true), D()> ByRef As Integer) As Integer{0}" +
1864 "End Interface{0}", NewLine), code);
1868 public override void MethodImplementationTypes ()
1870 string code = GenerateMethodImplementationTypes (Options);
1871 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1872 "Public Interface Test1{0}" +
1874 " Function Execute() As Integer Implements IPolicy.Execute , IWhatever.Execute{0}" +
1875 "End Interface{0}", NewLine), code);
1879 public override void MethodOverloadsTest1 ()
1881 string code = GenerateMethodOverloads1 (Options);
1882 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1883 "Public Interface Test1{0}" +
1885 " Function Execute() As Integer{0}" +
1886 "End Interface{0}", NewLine), code);
1890 public override void MethodOverloadsTest2 ()
1892 string code = GenerateMethodOverloads2 (Options);
1893 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1894 "Public Interface Test1{0}" +
1896 " Sub Execute(){0}" +
1898 " Function Execute(ByVal value1 As Object) As Integer{0}" +
1899 "End Interface{0}", NewLine), code);
1903 public override void MethodOverloadsTest3 ()
1905 string code = GenerateMethodOverloads3 (Options);
1906 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1907 "Public Interface Test1{0}" +
1909 " Sub Execute(){0}" +
1911 " Function System_Int32_Execute(ByVal value1 As Object) As Integer Implements Integer.Execute{0}" +
1912 "End Interface{0}", NewLine), code);
1916 public override void MethodPrivateImplementationType ()
1918 string code = GenerateMethodPrivateImplementationType (Options);
1919 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1920 "Public Interface Test1{0}" +
1922 " Function System_Int32_Execute(ByVal value1 As Object) As Integer Implements Integer.Execute{0}" +
1923 "End Interface{0}", NewLine), code);
1927 public override void MethodImplementationTypeOrder ()
1929 string code = GenerateMethodImplementationTypeOrder (Options);
1930 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1931 "Public Interface Test1{0}" +
1933 " Function System_Int32_Execute(ByVal value1 As Object) As Integer Implements IPolicy.Execute{0}" +
1934 "End Interface{0}", NewLine), code);
1938 public override void MethodReturnTypeAttributes ()
1940 string code = GenerateMethodReturnTypeAttributes (Options);
1941 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1942 "Public Interface Test1{0}" +
1946 " Function Execute() As <C(A1:=false, A2:=true), D()> Integer{0}" +
1947 "End Interface{0}", NewLine), code);
1951 public override void MethodNewSlotTest ()
1953 string code = GenerateMethodNewSlot (Options);
1954 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1955 "Public Interface Test1{0}" +
1957 " Shadows Function Execute() As Integer{0}" +
1958 "End Interface{0}", NewLine), code);
1962 public override void ConstructorAttributesTest ()
1964 string code = GenerateConstructorAttributes (Options);
1965 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1966 "Public Interface Test1{0}" +
1968 "End Interface{0}", NewLine), code);
1972 public override void ConstructorParametersTest ()
1974 string code = GenerateConstructorParameters (Options);
1975 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1976 "Public Interface Test1{0}" +
1978 "End Interface{0}", NewLine), code);
1982 public override void ConstructorParameterAttributesTest ()
1984 string code = GenerateConstructorParameterAttributes (Options);
1985 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1986 "Public Interface Test1{0}" +
1988 "End Interface{0}", NewLine), code);
1992 public override void BaseConstructorSingleArg ()
1994 string code = GenerateBaseConstructor (false, Options);
1995 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
1996 "Public Interface Test1{0}" +
1998 "End Interface{0}", NewLine), code);
2002 public override void BaseConstructorMultipleArgs ()
2004 string code = GenerateBaseConstructor (true, Options);
2005 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2006 "Public Interface Test1{0}" +
2008 "End Interface{0}", NewLine), code);
2012 public override void ChainedConstructorSingleArg ()
2014 string code = GenerateChainedConstructor (false, Options);
2015 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2016 "Public Interface Test1{0}" +
2018 "End Interface{0}", NewLine), code);
2022 public override void ChainedConstructorMultipleArgs ()
2024 string code = GenerateChainedConstructor (true, Options);
2025 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2026 "Public Interface Test1{0}" +
2028 "End Interface{0}", NewLine), code);
2032 public override void TypeConstructorTest ()
2034 string code = GenerateTypeConstructor (Options);
2035 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2036 "Public Interface Test1{0}" +
2038 "End Interface{0}", NewLine), code);
2042 public override void EntryPointMethodTest ()
2044 string code = GenerateEntryPointMethod (Options);
2045 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2046 "Public Interface Test1{0}" +
2051 " Public Shared Sub Main(){0}" +
2052 " Dim x As Test.InnerType{0}" +
2054 "End Interface{0}", NewLine), code);
2059 public class CodeGeneratorFromTypeTest_Struct : CodeGeneratorFromTypeTestBase
2061 private CodeTypeDeclaration _typeDeclaration;
2062 private ICodeGenerator _codeGenerator;
2064 protected override ICodeGenerator CodeGenerator
2066 get { return _codeGenerator; }
2069 protected override CodeTypeDeclaration TypeDeclaration
2071 get { return _typeDeclaration; }
2075 public override void SetUp ()
2078 _typeDeclaration = new CodeTypeDeclaration ();
2079 _typeDeclaration.IsStruct = true;
2081 CodeDomProvider provider = new VBCodeProvider ();
2082 _codeGenerator = provider.CreateGenerator ();
2086 public override void DefaultTypeTest ()
2088 string code = GenerateDefaultType (Options);
2089 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2090 "Public Structure {0}" +
2091 "End Structure{0}", NewLine), code);
2095 [ExpectedException (typeof (NullReferenceException))]
2096 public override void NullTypeTest ()
2098 GenerateNullType (Options);
2102 public override void SimpleTypeTest ()
2104 string code = GenerateSimpleType (Options);
2105 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2106 "Public Structure Test1{0}" +
2107 "End Structure{0}", NewLine), code);
2111 public override void DerivedTypeTest ()
2113 string code = GenerateDerivedType (Options);
2114 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2116 "Friend Structure Test1{0}" +
2118 "Structure Test1{0}" +
2120 " Implements Integer, System.Security.Principal.IIdentity, String, System.Security.IPermission{0}" +
2121 "End Structure{0}", NewLine), code);
2125 public override void AttributesAndTypeTest ()
2127 string code = GenerateAttributesAndType (Options);
2128 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2131 "Public Structure Test1{0}" +
2132 "End Structure{0}", NewLine), code);
2136 public override void EventMembersTypeTest1 ()
2138 string code = GenerateEventMembersType1 (Options);
2139 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2140 "Public Structure Test1{0}" +
2145 " Private Event __exception As System.Void{0}" +
2147 " Private Event As System.Void{0}" +
2149 "End Structure{0}", NewLine), code);
2153 public override void EventMembersTypeTest2 ()
2155 string code = GenerateEventMembersType2 (Options);
2156 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2157 "Public Structure Test1{0}" +
2159 " Public Event Click As Integer{0}" +
2160 "End Structure{0}", NewLine), code);
2164 public override void EventImplementationTypes ()
2166 string code = GenerateEventImplementationTypes (Options);
2167 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2168 "Public Structure Test1{0}" +
2171 " Friend Event Click As Integer Implements IPolicy.Click , IWhatever.Click{0}" +
2173 " Friend Event Click As Integer{0}" +
2175 "End Structure{0}", NewLine), code);
2179 public override void EventPrivateImplementationType ()
2181 string code = GenerateEventPrivateImplementationType (Options);
2182 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2183 "Public Structure Test1{0}" +
2186 " Protected Event System_Int32_Click As Integer Implements Integer.Click{0}" +
2188 " Protected Event Click As Integer{0}" +
2190 "End Structure{0}", NewLine), code);
2194 public override void EventImplementationTypeOrder ()
2196 string code = GenerateEventImplementationTypeOrder (Options);
2197 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2198 "Public Structure Test1{0}" +
2201 " Public Event System_Int32_Click As Integer Implements IPolicy.Click{0}" +
2203 " Public Event Click As Integer{0}" +
2205 "End Structure{0}", NewLine), code);
2209 public override void FieldMembersAttributesTest ()
2211 string code = GenerateFieldMembersAttributes (Options);
2212 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2213 "Public Structure Test1{0}" +
2218 " Private __exception As System.Void{0}" +
2220 " Private As System.Void{0}" +
2222 "End Structure{0}", NewLine), code);
2226 public override void FieldMembersTypeTest ()
2228 string code = GenerateFieldMembersType (MemberAttributes.Public, Options);
2229 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2230 "Public Structure Test1{0}" +
2232 " Public Name As Integer = 2{0}" +
2233 "End Structure{0}", NewLine), code);
2237 public override void FieldNewSlotTest ()
2239 string code = GenerateFieldMembersType (MemberAttributes.Assembly |
2240 MemberAttributes.New, Options);
2241 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2242 "Public Structure Test1{0}" +
2244 " Friend Shadows Name As Integer = 2{0}" +
2245 "End Structure{0}", NewLine), code);
2249 public override void PropertyMembersTypeTest1 ()
2251 string code = GeneratePropertyMembersAttributes (Options);
2252 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2253 "Public Structure Test1{0}" +
2258 " Private Property () As System.Void{0}" +
2260 " Private Property As System.Void{0}" +
2262 " End Property{0}" +
2263 "End Structure{0}", NewLine), code);
2267 public override void PropertyMembersTypeTest2 ()
2269 string code = GeneratePropertyMembersType (MemberAttributes.Public,
2270 false, false, Options);
2271 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2272 "Public Structure Test1{0}" +
2275 " Public Overridable Property Name() As Integer{0}" +
2277 " Public Overridable Property Name As Integer{0}" +
2279 " End Property{0}" +
2280 "End Structure{0}", NewLine), code);
2284 public override void PropertyMembersTypeGetOnly ()
2286 string code = GeneratePropertyMembersType (MemberAttributes.Family,
2287 true, false, Options);
2288 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2289 "Public Structure Test1{0}" +
2292 " Protected Overridable ReadOnly Property Name() As Integer{0}" +
2294 " Protected Overridable ReadOnly Property Name As Integer{0}" +
2298 " End Property{0}" +
2299 "End Structure{0}", NewLine), code);
2303 public override void PropertyMembersTypeSetOnly ()
2305 string code = GeneratePropertyMembersType (MemberAttributes.Assembly,
2306 false, true, Options);
2307 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2308 "Public Structure Test1{0}" +
2311 " Friend Overridable WriteOnly Property Name() As Integer{0}" +
2313 " Friend WriteOnly Property Name As Integer{0}" +
2317 " End Property{0}" +
2318 "End Structure{0}", NewLine), code);
2322 public override void PropertyMembersTypeGetSet ()
2324 string code = GeneratePropertyMembersType (MemberAttributes.Family,
2325 true, true, Options);
2326 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2327 "Public Structure Test1{0}" +
2330 " Protected Overridable Property Name() As Integer{0}" +
2332 " Protected Overridable Property Name As Integer{0}" +
2338 " End Property{0}" +
2339 "End Structure{0}", NewLine), code);
2343 // A bug in MS.NET 1.x causes MemberAttributes.FamilyOrAssembly to be
2344 // generated as Protected
2345 [Category ("NotDotNet")]
2348 public override void PropertyMembersTypeFamilyOrAssembly ()
2350 string code = GeneratePropertyMembersType (MemberAttributes.FamilyOrAssembly,
2351 false, false, Options);
2352 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2353 "Public Structure Test1{0}" +
2356 " Protected Friend Property Name() As Integer{0}" +
2358 " Protected Friend Property Name As Integer{0}" +
2360 " End Property{0}" +
2361 "End Structure{0}", NewLine), code);
2365 public override void PropertyMembersTypeAssembly ()
2367 string code = GeneratePropertyMembersType (MemberAttributes.Assembly,
2368 false, false, Options);
2369 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2370 "Public Structure Test1{0}" +
2373 " Friend Overridable Property Name() As Integer{0}" +
2375 " Friend Property Name As Integer{0}" +
2377 " End Property{0}" +
2378 "End Structure{0}", NewLine), code);
2382 public override void PropertyParametersTest ()
2384 string code = GeneratePropertyParameters (Options);
2385 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2386 "Public Structure Test1{0}" +
2388 " Public Overridable Property Name(ByVal value1 As Object, ByRef value2 As Integer) As Integer{0}" +
2389 " End Property{0}" +
2390 "End Structure{0}", NewLine), code);
2394 public override void PropertyIndexerTest1 ()
2396 string code = GeneratePropertyIndexer (MemberAttributes.Public,
2397 false, false, true, Options);
2398 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2399 "Public Structure Test1{0}" +
2401 " Public Overridable Default Property iTem(ByVal value1 As Object, ByRef value2 As Integer) As Integer{0}" +
2402 " End Property{0}" +
2403 "End Structure{0}", NewLine), code);
2407 public override void PropertyIndexerTest2 ()
2409 string code = GeneratePropertyIndexer (MemberAttributes.Public,
2410 false, false, false, Options);
2411 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2412 "Public Structure Test1{0}" +
2415 " Public Overridable Property iTem() As Integer{0}" +
2417 " Public Overridable Property iTem As Integer{0}" +
2419 " End Property{0}" +
2420 "End Structure{0}", NewLine), code);
2424 public override void PropertyIndexerGetOnly ()
2426 string code = GeneratePropertyIndexer (MemberAttributes.Family,
2427 true, false, true, Options);
2428 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2429 "Public Structure Test1{0}" +
2431 " Protected Overridable Default ReadOnly Property iTem(ByVal value1 As Object, ByRef value2 As Integer) As Integer{0}" +
2434 " End Property{0}" +
2435 "End Structure{0}", NewLine), code);
2439 public override void PropertyIndexerSetOnly ()
2441 string code = GeneratePropertyIndexer (MemberAttributes.Family,
2442 false, true, true, Options);
2443 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2444 "Public Structure Test1{0}" +
2446 " Protected Overridable Default WriteOnly Property iTem(ByVal value1 As Object, ByRef value2 As Integer) As Integer{0}" +
2449 " End Property{0}" +
2450 "End Structure{0}", NewLine), code);
2454 public override void PropertyImplementationTypes ()
2456 string code = GeneratePropertyImplementationTypes (Options);
2457 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2458 "Public Structure Test1{0}" +
2461 " Public Overridable Property Name() As Integer Implements IPolicy.Name , IWhatever.Name{0}" +
2463 " Public Overridable Property Name As Integer Implements IPolicy.Name , IWhatever.Name{0}" +
2465 " End Property{0}" +
2466 "End Structure{0}", NewLine), code);
2470 public override void PropertyOverloadsTest1 ()
2472 string code = GeneratePropertyOverloads1 (Options);
2473 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2474 "Public Structure Test1{0}" +
2477 " Protected Overloads Overridable Property Name() As Integer{0}" +
2479 " Protected Overloads Overridable Property Name As Integer{0}" +
2481 " End Property{0}" +
2482 "End Structure{0}", NewLine), code);
2486 public override void PropertyOverloadsTest2 ()
2488 string code = GeneratePropertyOverloads2 (Options);
2489 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2490 "Public Structure Test1{0}" +
2493 " Public Overloads Overridable Property Name() As Integer{0}" +
2495 " Public Overloads Overridable Property Name As Integer{0}" +
2497 " End Property{0}" +
2499 " Private Overloads Property Name(ByVal value1 As Object) As Integer{0}" +
2500 " End Property{0}" +
2501 "End Structure{0}", NewLine), code);
2505 public override void PropertyOverloadsTest3 ()
2507 string code = GeneratePropertyOverloads3 (Options);
2508 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2509 "Public Structure Test1{0}" +
2512 " Public Overridable Property Name() As Integer{0}" +
2514 " Public Overridable Property Name As Integer{0}" +
2516 " End Property{0}" +
2518 " Property System_Int32_Name(ByVal value1 As Object) As Integer Implements Integer.Name{0}" +
2519 " End Property{0}" +
2520 "End Structure{0}", NewLine), code);
2524 public override void PropertyPrivateImplementationType ()
2526 string code = GeneratePropertyPrivateImplementationType (Options);
2527 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2528 "Public Structure Test1{0}" +
2530 " Overridable Property System_Int32_Item(ByVal value1 As Object) As Integer Implements Integer.Item{0}" +
2531 " End Property{0}" +
2532 "End Structure{0}", NewLine), code);
2536 public override void PropertyImplementationTypeOrder ()
2538 string code = GeneratePropertyImplementationTypeOrder (Options);
2539 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2540 "Public Structure Test1{0}" +
2542 " Overridable Property System_Int32_Item(ByVal value1 As Object) As Integer Implements IPolicy.Item{0}" +
2543 " End Property{0}" +
2544 "End Structure{0}", NewLine), code);
2548 public override void PropertyNewSlotTest ()
2550 string code = GeneratePropertyMembersType (MemberAttributes.Private |
2551 MemberAttributes.New, true, true, Options);
2552 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2553 "Public Structure Test1{0}" +
2556 " Private Shadows Property Name() As Integer{0}" +
2558 " Private Shadows Property Name As Integer{0}" +
2564 " End Property{0}" +
2565 "End Structure{0}", NewLine), code);
2569 public override void MethodMembersTypeTest1 ()
2571 string code = GenerateMethodMembersType1 (Options);
2572 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2573 "Public Structure Test1{0}" +
2577 " Private Sub (){0}" +
2579 "End Structure{0}", NewLine), code);
2583 public override void MethodMembersTypeTest2 ()
2585 string code = GenerateMethodMembersType2 (Options);
2586 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2587 "Public Structure Test1{0}" +
2589 " Public Overridable Function Something(ByVal value1 As Object, ByVal value2 As Object, ByRef index As Integer, ByRef count As Integer) As Integer{0}" +
2590 " End Function{0}" +
2591 "End Structure{0}", NewLine), code);
2595 public override void MethodMembersTypeTest3 ()
2597 string code = GenerateMethodMembersType3 (Options);
2598 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2599 "Public Structure Test1{0}" +
2602 " Public Overridable Function Something(<A(), B()> ByVal value As Object, <C(A1:=false, A2:=true), D()> ByRef __exception As Integer) As Integer{0}" +
2604 " Public Overridable Function Something(<A(), B()> ByVal value As Object, <C(A1:=false, A2:=true), D()> ByRef As Integer) As Integer{0}" +
2606 " End Function{0}" +
2607 "End Structure{0}", NewLine), code);
2611 public override void MethodImplementationTypes ()
2613 string code = GenerateMethodImplementationTypes (Options);
2614 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2615 "Public Structure Test1{0}" +
2618 " Friend Overridable Function Execute() As Integer Implements IPolicy.Execute , IWhatever.Execute{0}" +
2620 " Friend Function Execute() As Integer Implements IPolicy.Execute , IWhatever.Execute{0}" +
2622 " End Function{0}" +
2623 "End Structure{0}", NewLine), code);
2627 public override void MethodOverloadsTest1 ()
2629 string code = GenerateMethodOverloads1 (Options);
2630 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2631 "Public Structure Test1{0}" +
2634 " Friend Overloads Overridable Function Execute() As Integer{0}" +
2636 " Friend Overloads Function Execute() As Integer{0}" +
2638 " End Function{0}" +
2639 "End Structure{0}", NewLine), code);
2643 public override void MethodOverloadsTest2 ()
2645 string code = GenerateMethodOverloads2 (Options);
2646 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2647 "Public Structure Test1{0}" +
2649 " Public Overloads Overridable Sub Execute(){0}" +
2652 " Private Overloads Function Execute(ByVal value1 As Object) As Integer{0}" +
2653 " End Function{0}" +
2654 "End Structure{0}", NewLine), code);
2658 public override void MethodOverloadsTest3 ()
2660 string code = GenerateMethodOverloads3 (Options);
2661 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2662 "Public Structure Test1{0}" +
2664 " Public Overridable Sub Execute(){0}" +
2667 " Function System_Int32_Execute(ByVal value1 As Object) As Integer Implements Integer.Execute{0}" +
2668 " End Function{0}" +
2669 "End Structure{0}", NewLine), code);
2673 public override void MethodPrivateImplementationType ()
2675 string code = GenerateMethodPrivateImplementationType (Options);
2676 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2677 "Public Structure Test1{0}" +
2679 " Overridable Function System_Int32_Execute(ByVal value1 As Object) As Integer Implements Integer.Execute{0}" +
2680 " End Function{0}" +
2681 "End Structure{0}", NewLine), code);
2685 public override void MethodImplementationTypeOrder ()
2687 string code = GenerateMethodImplementationTypeOrder (Options);
2688 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2689 "Public Structure Test1{0}" +
2691 " Overridable Function System_Int32_Execute(ByVal value1 As Object) As Integer Implements IPolicy.Execute{0}" +
2692 " End Function{0}" +
2693 "End Structure{0}", NewLine), code);
2697 public override void MethodReturnTypeAttributes ()
2699 string code = GenerateMethodReturnTypeAttributes (Options);
2700 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2701 "Public Structure Test1{0}" +
2705 " Public Overridable Function Execute() As <C(A1:=false, A2:=true), D()> Integer{0}" +
2706 " End Function{0}" +
2707 "End Structure{0}", NewLine), code);
2711 public override void MethodNewSlotTest ()
2713 string code = GenerateMethodNewSlot (Options);
2714 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2715 "Public Structure Test1{0}" +
2717 " Public Shadows Overridable Function Execute() As Integer{0}" +
2718 " End Function{0}" +
2719 "End Structure{0}", NewLine), code);
2723 public override void ConstructorAttributesTest ()
2725 // FIXME: updated to reflect mbas workaround
2726 string code = GenerateConstructorAttributes (Options);
2727 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2728 "Public Structure Test1{0}" +
2732 " Private Sub New(){0}" +
2737 "End Structure{0}", NewLine), code);
2741 public override void ConstructorParametersTest ()
2743 // FIXME: updated to reflect mbas workaround
2744 string code = GenerateConstructorParameters (Options);
2745 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2746 "Public Structure Test1{0}" +
2748 " Public Sub New(ByVal value1 As Object, ByVal value2 As Object, ByRef index As Integer, ByRef count As Integer){0}" +
2753 "End Structure{0}", NewLine), code);
2757 public override void ConstructorParameterAttributesTest ()
2759 // FIXME: updated to reflect mbas workaround
2760 string code = GenerateConstructorParameterAttributes (Options);
2761 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2762 "Public Structure Test1{0}" +
2764 " Private Sub New(<A(), B()> ByVal value As Object, <C(A1:=false, A2:=true), D()> ByRef index As Integer){0}" +
2769 "End Structure{0}", NewLine), code);
2773 public override void BaseConstructorSingleArg ()
2775 string code = GenerateBaseConstructor (false, Options);
2776 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2777 "Public Structure Test1{0}" +
2779 " Protected Sub New(ByVal value1 As Object, ByRef value2 As Integer){0}" +
2780 " MyBase.New(value1){0}" +
2782 "End Structure{0}", NewLine), code);
2786 public override void BaseConstructorMultipleArgs ()
2788 string code = GenerateBaseConstructor (true, Options);
2789 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2790 "Public Structure Test1{0}" +
2792 " Protected Sub New(ByVal value1 As Object, ByRef value2 As Integer){0}" +
2793 " MyBase.New(value1, value2){0}" +
2795 "End Structure{0}", NewLine), code);
2799 public override void ChainedConstructorSingleArg ()
2801 string code = GenerateChainedConstructor (false, Options);
2802 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2803 "Public Structure Test1{0}" +
2805 " Public Sub New(ByVal value1 As Object, ByRef value2 As Integer){0}" +
2806 " Me.New(value1){0}" +
2808 "End Structure{0}", NewLine), code);
2812 public override void ChainedConstructorMultipleArgs ()
2814 string code = GenerateChainedConstructor (true, Options);
2815 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2816 "Public Structure Test1{0}" +
2818 " Public Sub New(ByVal value1 As Object, ByRef value2 As Integer){0}" +
2819 " Me.New(value1, value2){0}" +
2821 "End Structure{0}", NewLine), code);
2825 public override void TypeConstructorTest ()
2827 string code = GenerateTypeConstructor (Options);
2828 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2829 "Public Structure Test1{0}" +
2835 " Shared Sub New(){0}" +
2837 "End Structure{0}", NewLine), code);
2841 public override void EntryPointMethodTest ()
2843 string code = GenerateEntryPointMethod (Options);
2844 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2845 "Public Structure Test1{0}" +
2850 " Public Shared Sub Main(){0}" +
2851 " Dim x As Test.InnerType{0}" +
2853 "End Structure{0}", NewLine), code);
2858 public class CodeGeneratorFromTypeTest_Enum : CodeGeneratorFromTypeTestBase
2860 private CodeTypeDeclaration _typeDeclaration;
2861 private ICodeGenerator _codeGenerator;
2863 protected override ICodeGenerator CodeGenerator
2865 get { return _codeGenerator; }
2868 protected override CodeTypeDeclaration TypeDeclaration
2870 get { return _typeDeclaration; }
2874 public override void SetUp ()
2877 _typeDeclaration = new CodeTypeDeclaration ();
2878 _typeDeclaration.IsEnum = true;
2880 CodeDomProvider provider = new VBCodeProvider ();
2881 _codeGenerator = provider.CreateGenerator ();
2885 public override void DefaultTypeTest ()
2887 string code = GenerateDefaultType (Options);
2888 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2890 "End Enum{0}", NewLine), code);
2894 [ExpectedException (typeof (NullReferenceException))]
2895 public override void NullTypeTest ()
2897 GenerateNullType (Options);
2901 public override void SimpleTypeTest ()
2903 string code = GenerateSimpleType (Options);
2904 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2905 "Public Enum Test1{0}" +
2906 "End Enum{0}", NewLine), code);
2910 public override void DerivedTypeTest ()
2912 string code = GenerateDerivedType (Options);
2913 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2915 "Friend Enum Test1 As Integer{0}" +
2917 "Enum Test1 As Integer{0}" +
2919 "End Enum{0}", NewLine), code);
2923 public override void AttributesAndTypeTest ()
2925 string code = GenerateAttributesAndType (Options);
2926 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2929 "Public Enum Test1{0}" +
2930 "End Enum{0}", NewLine), code);
2934 public override void EventMembersTypeTest1 ()
2936 string code = GenerateEventMembersType1 (Options);
2937 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2938 "Public Enum Test1{0}" +
2940 "End Enum{0}", NewLine), code);
2944 public override void EventMembersTypeTest2 ()
2946 string code = GenerateEventMembersType2 (Options);
2947 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2948 "Public Enum Test1{0}" +
2950 "End Enum{0}", NewLine), code);
2954 public override void EventImplementationTypes ()
2956 string code = GenerateEventImplementationTypes (Options);
2957 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2958 "Public Enum Test1{0}" +
2960 "End Enum{0}", NewLine), code);
2964 public override void EventPrivateImplementationType ()
2966 string code = GenerateEventPrivateImplementationType (Options);
2967 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2968 "Public Enum Test1{0}" +
2970 "End Enum{0}", NewLine), code);
2974 public override void EventImplementationTypeOrder ()
2976 string code = GenerateEventImplementationTypeOrder (Options);
2977 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2978 "Public Enum Test1{0}" +
2980 "End Enum{0}", NewLine), code);
2984 public override void FieldMembersAttributesTest ()
2986 string code = GenerateFieldMembersAttributes (Options);
2987 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
2988 "Public Enum Test1{0}" +
2993 "End Enum{0}", NewLine), code);
2997 public override void FieldMembersTypeTest ()
2999 string code = GenerateFieldMembersType (MemberAttributes.Public, Options);
3000 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3001 "Public Enum Test1{0}" +
3004 "End Enum{0}", NewLine), code);
3008 public override void FieldNewSlotTest ()
3010 string code = GenerateFieldMembersType (MemberAttributes.Assembly |
3011 MemberAttributes.New, Options);
3012 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3013 "Public Enum Test1{0}" +
3016 "End Enum{0}", NewLine), code);
3020 public override void PropertyMembersTypeTest1 ()
3022 string code = GeneratePropertyMembersAttributes (Options);
3023 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3024 "Public Enum Test1{0}" +
3026 "End Enum{0}", NewLine), code);
3030 public override void PropertyMembersTypeTest2 ()
3032 string code = GeneratePropertyMembersType (MemberAttributes.Public,
3033 false, false, Options);
3034 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3035 "Public Enum Test1{0}" +
3037 "End Enum{0}", NewLine), code);
3041 public override void PropertyMembersTypeGetOnly ()
3043 string code = GeneratePropertyMembersType (MemberAttributes.Family,
3044 true, false, Options);
3045 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3046 "Public Enum Test1{0}" +
3048 "End Enum{0}", NewLine), code);
3052 public override void PropertyMembersTypeSetOnly ()
3054 string code = GeneratePropertyMembersType (MemberAttributes.Assembly,
3055 false, true, Options);
3056 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3057 "Public Enum Test1{0}" +
3059 "End Enum{0}", NewLine), code);
3063 public override void PropertyMembersTypeGetSet ()
3065 string code = GeneratePropertyMembersType (MemberAttributes.Family,
3066 true, true, Options);
3067 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3068 "Public Enum Test1{0}" +
3070 "End Enum{0}", NewLine), code);
3074 public override void PropertyMembersTypeFamilyOrAssembly ()
3076 string code = GeneratePropertyMembersType (MemberAttributes.FamilyOrAssembly,
3077 false, false, Options);
3078 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3079 "Public Enum Test1{0}" +
3081 "End Enum{0}", NewLine), code);
3085 public override void PropertyMembersTypeAssembly ()
3087 string code = GeneratePropertyMembersType (MemberAttributes.Assembly,
3088 false, false, Options);
3089 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3090 "Public Enum Test1{0}" +
3092 "End Enum{0}", NewLine), code);
3096 public override void PropertyParametersTest ()
3098 string code = GeneratePropertyParameters (Options);
3099 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3100 "Public Enum Test1{0}" +
3102 "End Enum{0}", NewLine), code);
3106 public override void PropertyIndexerTest1 ()
3108 string code = GeneratePropertyIndexer (MemberAttributes.Public,
3109 false, false, true, Options);
3110 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3111 "Public Enum Test1{0}" +
3113 "End Enum{0}", NewLine), code);
3117 public override void PropertyIndexerTest2 ()
3119 string code = GeneratePropertyIndexer (MemberAttributes.Public,
3120 false, false, false, Options);
3121 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3122 "Public Enum Test1{0}" +
3124 "End Enum{0}", NewLine), code);
3128 public override void PropertyIndexerGetOnly ()
3130 string code = GeneratePropertyIndexer (MemberAttributes.Family,
3131 true, false, true, Options);
3132 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3133 "Public Enum Test1{0}" +
3135 "End Enum{0}", NewLine), code);
3139 public override void PropertyIndexerSetOnly ()
3141 string code = GeneratePropertyIndexer (MemberAttributes.Family,
3142 false, true, true, Options);
3143 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3144 "Public Enum Test1{0}" +
3146 "End Enum{0}", NewLine), code);
3150 public override void PropertyImplementationTypes ()
3152 string code = GeneratePropertyImplementationTypes (Options);
3153 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3154 "Public Enum Test1{0}" +
3156 "End Enum{0}", NewLine), code);
3160 public override void PropertyOverloadsTest1 ()
3162 string code = GeneratePropertyOverloads1 (Options);
3163 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3164 "Public Enum Test1{0}" +
3166 "End Enum{0}", NewLine), code);
3170 public override void PropertyOverloadsTest2 ()
3172 string code = GeneratePropertyOverloads2 (Options);
3173 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3174 "Public Enum Test1{0}" +
3177 "End Enum{0}", NewLine), code);
3181 public override void PropertyOverloadsTest3 ()
3183 string code = GeneratePropertyOverloads3 (Options);
3184 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3185 "Public Enum Test1{0}" +
3188 "End Enum{0}", NewLine), code);
3192 public override void PropertyPrivateImplementationType ()
3194 string code = GeneratePropertyPrivateImplementationType (Options);
3195 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3196 "Public Enum Test1{0}" +
3198 "End Enum{0}", NewLine), code);
3202 public override void PropertyImplementationTypeOrder ()
3204 string code = GeneratePropertyImplementationTypeOrder (Options);
3205 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3206 "Public Enum Test1{0}" +
3208 "End Enum{0}", NewLine), code);
3212 public override void PropertyNewSlotTest ()
3214 string code = GeneratePropertyMembersType (MemberAttributes.Private |
3215 MemberAttributes.New, true, true, Options);
3216 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3217 "Public Enum Test1{0}" +
3219 "End Enum{0}", NewLine), code);
3223 public override void MethodMembersTypeTest1 ()
3225 string code = GenerateMethodMembersType1 (Options);
3226 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3227 "Public Enum Test1{0}" +
3229 "End Enum{0}", NewLine), code);
3233 public override void MethodMembersTypeTest2 ()
3235 string code = GenerateMethodMembersType2 (Options);
3236 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3237 "Public Enum Test1{0}" +
3239 "End Enum{0}", NewLine), code);
3243 public override void MethodMembersTypeTest3 ()
3245 string code = GenerateMethodMembersType3 (Options);
3246 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3247 "Public Enum Test1{0}" +
3249 "End Enum{0}", NewLine), code);
3253 public override void MethodImplementationTypes ()
3255 string code = GenerateMethodImplementationTypes (Options);
3256 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3257 "Public Enum Test1{0}" +
3259 "End Enum{0}", NewLine), code);
3263 public override void MethodOverloadsTest1 ()
3265 string code = GenerateMethodOverloads1 (Options);
3266 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3267 "Public Enum Test1{0}" +
3269 "End Enum{0}", NewLine), code);
3273 public override void MethodOverloadsTest2 ()
3275 string code = GenerateMethodOverloads2 (Options);
3276 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3277 "Public Enum Test1{0}" +
3280 "End Enum{0}", NewLine), code);
3284 public override void MethodOverloadsTest3 ()
3286 string code = GenerateMethodOverloads3 (Options);
3287 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3288 "Public Enum Test1{0}" +
3291 "End Enum{0}", NewLine), code);
3295 public override void MethodPrivateImplementationType ()
3297 string code = GenerateMethodPrivateImplementationType (Options);
3298 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3299 "Public Enum Test1{0}" +
3301 "End Enum{0}", NewLine), code);
3305 public override void MethodImplementationTypeOrder ()
3307 string code = GenerateMethodImplementationTypeOrder (Options);
3308 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3309 "Public Enum Test1{0}" +
3311 "End Enum{0}", NewLine), code);
3315 public override void MethodReturnTypeAttributes ()
3317 string code = GenerateMethodReturnTypeAttributes (Options);
3318 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3319 "Public Enum Test1{0}" +
3321 "End Enum{0}", NewLine), code);
3325 public override void MethodNewSlotTest ()
3327 string code = GenerateMethodNewSlot (Options);
3328 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3329 "Public Enum Test1{0}" +
3331 "End Enum{0}", NewLine), code);
3335 public override void ConstructorAttributesTest ()
3337 string code = GenerateConstructorAttributes (Options);
3338 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3339 "Public Enum Test1{0}" +
3341 "End Enum{0}", NewLine), code);
3345 public override void ConstructorParametersTest ()
3347 string code = GenerateConstructorParameters (Options);
3348 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3349 "Public Enum Test1{0}" +
3351 "End Enum{0}", NewLine), code);
3355 public override void ConstructorParameterAttributesTest ()
3357 string code = GenerateConstructorParameterAttributes (Options);
3358 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3359 "Public Enum Test1{0}" +
3361 "End Enum{0}", NewLine), code);
3365 public override void BaseConstructorSingleArg ()
3367 string code = GenerateBaseConstructor (false, Options);
3368 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3369 "Public Enum Test1{0}" +
3371 "End Enum{0}", NewLine), code);
3375 public override void BaseConstructorMultipleArgs ()
3377 string code = GenerateBaseConstructor (true, Options);
3378 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3379 "Public Enum Test1{0}" +
3381 "End Enum{0}", NewLine), code);
3385 public override void ChainedConstructorSingleArg ()
3387 string code = GenerateChainedConstructor (false, Options);
3388 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3389 "Public Enum Test1{0}" +
3391 "End Enum{0}", NewLine), code);
3395 public override void ChainedConstructorMultipleArgs ()
3397 string code = GenerateChainedConstructor (true, Options);
3398 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3399 "Public Enum Test1{0}" +
3401 "End Enum{0}", NewLine), code);
3405 public override void TypeConstructorTest ()
3407 string code = GenerateTypeConstructor (Options);
3408 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3409 "Public Enum Test1{0}" +
3411 "End Enum{0}", NewLine), code);
3415 public override void EntryPointMethodTest ()
3417 string code = GenerateEntryPointMethod (Options);
3418 Assert.AreEqual (string.Format (CultureInfo.InvariantCulture,
3419 "Public Enum Test1{0}" +
3424 " Public Shared Sub Main(){0}" +
3425 " Dim x As Test.InnerType{0}" +
3427 "End Enum{0}", NewLine), code);