コード例 #1
0
        public override void Initialize()
        {
            base.Initialize();

            generalPropertyPage = new GeneralPropertyPage();

            customProjectPackage = new CustomProjectPackage();
            ((IVsPackage)customProjectPackage).SetSite(serviceProvider);

            customProjectFactory = new MyCustomProjectFactory(customProjectPackage);

            base.SetMsbuildEngine(customProjectFactory);

            int canCreate;

            if (VSConstants.S_OK == ((IVsProjectFactory)customProjectFactory).CanCreateProject(projectFile, 2, out canCreate))
            {
                PrivateType   type = new PrivateType(typeof(MyCustomProjectFactory));
                PrivateObject obj  = new PrivateObject(customProjectFactory, type);
                projectNode = (MyCustomProjectNode)obj.Invoke("PreCreateForOuter", new object[] { IntPtr.Zero });

                Guid iidProject = new Guid();
                int  pfCanceled;
                projectNode.Load(projectFile, "", "", 2, ref iidProject, out pfCanceled);
            }
        }
コード例 #2
0
        public void CreateProjectTest()
        {
            int actual;
            int expected = 1;

            MyCustomProjectFactory customProjectFactory = new MyCustomProjectFactory(customProjectPackage);

            base.SetMsbuildEngine(customProjectFactory);

            ((IVsProjectFactory)customProjectFactory).CanCreateProject(projectFile, (uint)__VSCREATEPROJFLAGS.CPF_OPENFILE, out actual);

            Assert.AreEqual(expected, actual, "Cannot create project");

            PrivateType   type = new PrivateType(typeof(MyCustomProjectFactory));
            PrivateObject obj  = new PrivateObject(customProjectFactory, type);

            MyCustomProjectNode projectNode = (MyCustomProjectNode)obj.Invoke("PreCreateForOuter", new object[] { IntPtr.Zero });

            Assert.IsNotNull(projectNode, "Cannot create project");
        }
コード例 #3
0
        public void ConstructorTest()
        {
            MyCustomProjectFactory myCustomProjectFactory = new MyCustomProjectFactory(customProjectPackage);

            Assert.IsNotNull(myCustomProjectFactory, "Constructor failed");
        }