private static void TestVisibility(string source, string className, string propertyName, SyntaxKind expectedVisibility)
        {
            // Assembling some code
            IAssemblyLoader assemblyLoader = new Utils.AsmlDasmlAssemblyLoader(source);

            // Loading the assembly
            IAssemblyProxy assembly = assemblyLoader.Load();

            // Locating the class
            ITypeInfoProxy classDefinition = assembly.LocateType("MyClass");

            Assert.IsNotNull(classDefinition);

            // Locating the field
            IFieldInfoProxy fieldDeclaration = classDefinition.LocateField("myField");

            Assert.IsNotNull(fieldDeclaration);

            // Generating the AST
            var factory    = new FieldDeclarationSyntaxFactory(fieldDeclaration);
            var syntaxNode = factory.Create();

            Assert.IsNotNull(syntaxNode, "A node was expected to be built");
            Assert.IsInstanceOfType(syntaxNode, typeof(FieldDeclarationSyntax), "Expected a field declaration node to be built");

            var fieldDeclarationSyntaxNode = syntaxNode as FieldDeclarationSyntax;

            var modifiers = fieldDeclarationSyntaxNode.Modifiers;

            Assert.IsTrue(Utils.CheckModifier(modifiers, expectedVisibility), "Method does not have correct visibility");
        }
        public void NameCorrectlyAcquired()
        {
            // Assembling some code
            IAssemblyLoader assemblyLoader = new Utils.AsmlDasmlAssemblyLoader(@"
                namespace MyNamespace {
                    public class MyClass {
                        public int myField;
                    }
                }
            ");

            // Loading the assembly
            IAssemblyProxy assembly = assemblyLoader.Load();

            // Locating the class
            ITypeInfoProxy classDefinition = assembly.LocateType("MyClass");

            Assert.IsNotNull(classDefinition);

            // Locating the field
            IFieldInfoProxy fieldDeclaration = classDefinition.LocateField("myField");

            Assert.IsNotNull(fieldDeclaration);

            // Generating the AST
            var factory    = new FieldDeclarationSyntaxFactory(fieldDeclaration);
            var syntaxNode = factory.Create();

            Assert.IsNotNull(syntaxNode, "A node was expected to be built");
            Assert.IsInstanceOfType(syntaxNode, typeof(FieldDeclarationSyntax), "Expected a field declaration node to be built");

            var fieldDeclarationSyntaxNode = syntaxNode as FieldDeclarationSyntax;

            var variables = fieldDeclarationSyntaxNode.Declaration.Variables;

            Assert.IsNotNull(variables);
            Assert.IsTrue(variables.Any());

            var variable = fieldDeclarationSyntaxNode.Declaration.Variables.First();

            Assert.IsNotNull(variable);

            var name = variable.Identifier.Text;

            Assert.AreEqual("myField", name, "Field name not correctly acquired");
        }
        public void StaticModifierCorrectlyAcquired()
        {
            // Assembling some code
            IAssemblyLoader assemblyLoader = new Utils.AsmlDasmlAssemblyLoader(@"
                namespace MyNamespace {
                    public class MyClass {
                        public static int myField1;
                        public int myField2;
                    }
                }
            ");

            // Loading the assembly
            IAssemblyProxy assembly = assemblyLoader.Load();

            // Locating the class
            ITypeInfoProxy classDefinition = assembly.LocateType("MyClass");

            Assert.IsNotNull(classDefinition);

            Action <string, bool> CheckStatic = (fieldName, expected) =>
            {
                // Locating the field
                IFieldInfoProxy fieldDeclaration = classDefinition.LocateField(fieldName);
                Assert.IsNotNull(fieldDeclaration);

                // Generating the AST
                var factory    = new FieldDeclarationSyntaxFactory(fieldDeclaration);
                var syntaxNode = factory.Create();

                Assert.IsNotNull(syntaxNode, "A node was expected to be built");
                Assert.IsInstanceOfType(syntaxNode, typeof(FieldDeclarationSyntax), "Expected a field declaration node to be built");

                var fieldDeclarationSyntaxNode = syntaxNode as FieldDeclarationSyntax;

                var modifiers = fieldDeclarationSyntaxNode.Modifiers;
                Assert.IsNotNull(modifiers);

                var staticModifier = modifiers.Where(modifier => modifier.Kind() == SyntaxKind.StaticKeyword);
                Assert.AreEqual(expected ? 1 : 0, staticModifier.Count(), expected ? "Expected one static modifier" : "No static modifier expected");
            };

            CheckStatic("myField1", true);
            CheckStatic("myField2", false);
        }
        public void TypeCorrectlyAcquired()
        {
            // Assembling some code
            IAssemblyLoader assemblyLoader = new Utils.AsmlDasmlAssemblyLoader(@"
                namespace MyNamespace {
                    public class MyClass {
                        public int myField;
                    }
                }
            ");

            // Loading the assembly
            IAssemblyProxy assembly = assemblyLoader.Load();

            // Locating the class
            ITypeInfoProxy classDefinition = assembly.LocateType("MyClass");

            Assert.IsNotNull(classDefinition);

            // Locating the field
            IFieldInfoProxy fieldDeclaration = classDefinition.LocateField("myField");

            Assert.IsNotNull(fieldDeclaration);

            // Generating the AST
            var factory    = new FieldDeclarationSyntaxFactory(fieldDeclaration);
            var syntaxNode = factory.Create();

            Assert.IsNotNull(syntaxNode, "A node was expected to be built");
            Assert.IsInstanceOfType(syntaxNode, typeof(FieldDeclarationSyntax), "Expected a field declaration node to be built");

            var fieldDeclarationSyntaxNode = syntaxNode as FieldDeclarationSyntax;

            var type = fieldDeclarationSyntaxNode.Declaration.Type;

            Assert.IsNotNull(type);

            var typeIdentifier = type as QualifiedNameSyntax;

            Assert.IsNotNull(typeIdentifier, "Type expected to be qualified name");
            Assert.AreEqual("System.Int32", typeIdentifier.ToString(), "Parameter name does not match");
        }