protected override object NewVariable(NewCodeElementItemParams newItemParams, string path, object value)
 {
     return(_codeClass.AddVariable(path,
                                   newItemParams.MemberType,
                                   newItemParams.Position,
                                   newItemParams.AccessKind,
                                   Type.Missing));
 }
        public void AddVariable_PublicSystemInt32Variable_AddsFieldWithCodeConverter()
        {
            CreateClass("class MyClass {}");
            var access = global::EnvDTE.vsCMAccess.vsCMAccessPublic;

            CaptureCodeGeneratorAddFieldAtStartParameters();
            string newCode =
                "class MyClass {\r\n" +
                "    public System.Int32 MyField;\r\n" +
                "}";

            UpdateCode(newCode);

            codeClass.AddVariable("MyField", "System.Int32", null, access, null);

            Assert.AreEqual(Accessibility.Public, addFieldAtStartAccess);
            Assert.AreEqual("MyField", addFieldAtStartName);
            Assert.AreEqual(codeClassTypeDefinition, addFieldAtStartTypeDef);
            Assert.AreEqual("System.Int32", addFieldAtStartReturnType.FullName);
            Assert.IsTrue(addFieldAtStartReturnType.IsKnownType(KnownTypeCode.Int32));
        }
Example #3
0
 public ShellCodeVariable AddVariable(string Name, object Type, object Position, vsCMAccess Access,
                                      object Location)
 {
     return(new ShellCodeVariable(_codeClass.AddVariable(Name, Type, Position, Access, Location) as CodeVariable2));
 }