2
// <copyright see="prj:///doc/copyright.txt"/>
3
// <license see="prj:///doc/license.txt"/>
4
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
5
// <version>$Revision: 915 $</version>
10
using NUnit.Framework;
11
using ICSharpCode.NRefactory.Parser;
12
using ICSharpCode.NRefactory.Parser.VB;
13
using ICSharpCode.NRefactory.Parser.AST;
15
namespace ICSharpCode.NRefactory.Tests.AST
18
public class AttributeSectionTests
21
public void AttributeOnStructure()
24
<StructLayout( LayoutKind.Explicit )> _
25
Public Structure MyUnion
27
<FieldOffset( 0 )> Public i As Integer
28
< FieldOffset( 0 )> Public d As Double
30
End Structure 'MyUnion
32
TypeDeclaration decl = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
33
Assert.AreEqual("StructLayout", decl.Attributes[0].Attributes[0].Name);
37
public void AttributeOnModule()
48
TypeDeclaration decl = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
49
Assert.AreEqual("HideModule", decl.Attributes[0].Attributes[0].Name);
53
public void GlobalAttributeVB()
55
string program = @"<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
59
TypeDeclaration decl = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
60
Assert.AreEqual("Microsoft.VisualBasic.CompilerServices.DesignerGenerated", decl.Attributes[0].Attributes[0].Name);
64
public void GlobalAttributeCSharp()
66
string program = @"[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
67
[someprefix::DesignerGenerated()]
70
TypeDeclaration decl = ParseUtilCSharp.ParseGlobal<TypeDeclaration>(program);
71
Assert.AreEqual("Microsoft.VisualBasic.CompilerServices.DesignerGenerated", decl.Attributes[0].Attributes[0].Name);
72
Assert.AreEqual("someprefix.DesignerGenerated", decl.Attributes[1].Attributes[0].Name);