~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/nrefactory/ICSharpCode.NRefactory.VB.Tests/General/UnitTest.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
Import upstream version 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Reflection;
 
6
using NUnit.Framework;
 
7
using ICSharpCode.NRefactory.VB.Ast;
 
8
using ICSharpCode.NRefactory.VB.Parser;
 
9
 
 
10
namespace ICSharpCode.NRefactory.VB.Tests
 
11
{
 
12
        [TestFixture]
 
13
        public class StructuralTest
 
14
        {
 
15
//              [Test]
 
16
//              public void TestToStringMethods()
 
17
//              {
 
18
//                      Type[] allTypes = typeof(INode).Assembly.GetTypes();
 
19
//                      
 
20
//                      foreach (Type type in allTypes) {
 
21
//                              if (type.IsClass && !type.IsAbstract && !type.IsNested && type.GetInterface(typeof(INode).FullName) != null) {
 
22
//                                      MethodInfo methodInfo = type.GetMethod("ToString", BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);
 
23
//                                      Assert.IsNotNull(methodInfo, "ToString() not found in " + type.FullName);
 
24
//                              }
 
25
//                      }
 
26
//              }
 
27
//              
 
28
//              [Test]
 
29
//              public void TestUnitTests()
 
30
//              {
 
31
//                      Type[] allTypes = typeof(StructuralTest).Assembly.GetTypes();
 
32
//                      
 
33
//                      foreach (Type type in allTypes) {
 
34
//                              if (type.GetCustomAttributes(typeof(TestFixtureAttribute), true).Length > 0) {
 
35
//                                      foreach (MethodInfo m in type.GetMethods()) {
 
36
//                                              if (m.IsPublic && m.ReturnType == typeof(void) && m.GetParameters().Length == 0) {
 
37
//                                                      if (m.GetCustomAttributes(typeof(TestAttribute), true).Length == 0) {
 
38
//                                                              Assert.Fail(type.Name + "." + m.Name + " should have the [Test] attribute!");
 
39
//                                                      }
 
40
//                                              }
 
41
//                                      }
 
42
//                              }
 
43
//                      }
 
44
//              }
 
45
//              
 
46
//              [Test]
 
47
//              public void TestAcceptVisitorMethods()
 
48
//              {
 
49
//                      Type[] allTypes = typeof(AbstractNode).Assembly.GetTypes();
 
50
//
 
51
//                      foreach (Type type in allTypes) {
 
52
//                              if (type.IsClass && !type.IsAbstract && type.GetInterface(typeof(INode).FullName) != null) {
 
53
//                                      MethodInfo methodInfo = type.GetMethod("AcceptVisitor", BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);
 
54
//                                      Assertion.AssertNotNull("AcceptVisitor() not found in " + type.FullName, methodInfo);
 
55
//                              }
 
56
//                      }
 
57
//              }
 
58
//              
 
59
//              [Test]
 
60
//              public void TestIAstVisitor()
 
61
//              {
 
62
//                      Type[] allTypes = typeof(AbstractNode).Assembly.GetTypes();
 
63
//                      Type visitor = typeof(IAstVisitor);
 
64
//                      
 
65
//                      foreach (Type type in allTypes) {
 
66
//                              if (type.IsClass && !type.IsAbstract && !type.IsNested && type.GetInterface(typeof(INode).FullName) != null && !type.Name.StartsWith("Null")) {
 
67
//                                      MethodInfo methodInfo = visitor.GetMethod("Visit" + type.Name, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.ExactBinding, null, new Type[] {type, typeof(object)}, null);
 
68
//                                      Assert.IsNotNull(methodInfo, "Visit with parameter " + type.FullName + " not found");
 
69
//                                      Assert.AreEqual(2, methodInfo.GetParameters().Length);
 
70
//                                      ParameterInfo first = methodInfo.GetParameters()[0];
 
71
//                                      Assert.AreEqual(Char.ToLower(first.ParameterType.Name[0]) + first.ParameterType.Name.Substring(1), first.Name);
 
72
//                                      
 
73
//                                      ParameterInfo second = methodInfo.GetParameters()[1];
 
74
//                                      Assert.AreEqual(typeof(System.Object), second.ParameterType);
 
75
//                                      Assert.AreEqual("data", second.Name);
 
76
//                              }
 
77
//                      }
 
78
//              }
 
79
//              
 
80
//              [Test]
 
81
//              public void TestAbstractAstVisitorVisitor()
 
82
//              {
 
83
//                      Type[] allTypes = typeof(AbstractNode).Assembly.GetTypes();
 
84
//                      Type visitor = typeof(AbstractAstVisitor);
 
85
//                      
 
86
//                      foreach (Type type in allTypes) {
 
87
//                              if (type.IsClass && !type.IsAbstract && !type.IsNested && type.GetInterface(typeof(INode).FullName) != null && !type.Name.StartsWith("Null")) {
 
88
//                                      MethodInfo methodInfo = visitor.GetMethod("Visit" + type.Name, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.ExactBinding, null, new Type[] {type, typeof(object)}, null);
 
89
//                                      Assert.IsNotNull(methodInfo, "Visit with parameter " + type.FullName + " not found");
 
90
//                                      
 
91
//                                      Assert.AreEqual(2, methodInfo.GetParameters().Length);
 
92
//                                      ParameterInfo first = methodInfo.GetParameters()[0];
 
93
//                                      Assert.AreEqual(Char.ToLower(first.ParameterType.Name[0]) + first.ParameterType.Name.Substring(1), first.Name);
 
94
//                                      
 
95
//                                      ParameterInfo second = methodInfo.GetParameters()[1];
 
96
//                                      Assert.AreEqual(typeof(System.Object), second.ParameterType);
 
97
//                                      Assert.AreEqual("data", second.Name);
 
98
//                              }
 
99
//                      }
 
100
//              }
 
101
        }
 
102
}