public override void Initialize() { base.Initialize(); generalPropertyPage = new XSharpGeneralPropertyPage(); customProjectPackage = new XSharpProjectPackage(); ((IVsPackage)customProjectPackage).SetSite(serviceProvider); customProjectFactory = new XSharpProjectFactory(customProjectPackage); base.SetMsbuildEngine(customProjectFactory); int canCreate; if(VSConstants.S_OK == ((IVsProjectFactory)customProjectFactory).CanCreateProject(projectFile, 2, out canCreate)) { PrivateType type = new PrivateType(typeof(XSharpProjectFactory)); PrivateObject obj = new PrivateObject(customProjectFactory, type); projectNode = (XSharpProjectNode)obj.Invoke("PreCreateForOuter", new object[] { IntPtr.Zero }); Guid iidProject = new Guid(); int pfCanceled; projectNode.Load(projectFile, "", "", 2, ref iidProject, out pfCanceled); } }
public void CreateProjectTest() { int actual; int expected = 1; XSharpProjectFactory customProjectFactory = new XSharpProjectFactory(customProjectPackage); base.SetMsbuildEngine(customProjectFactory); ((IVsProjectFactory)customProjectFactory).CanCreateProject(projectFile, 2, out actual); Assert.AreEqual(expected, actual, "Cannot create project"); PrivateType type = new PrivateType(typeof(XSharpProjectFactory)); PrivateObject obj = new PrivateObject(customProjectFactory, type); XSharpProjectNode projectNode = (XSharpProjectNode)obj.Invoke("PreCreateForOuter", new object[] { IntPtr.Zero }); Assert.IsNotNull(projectNode, "Cannot create project"); }
public void ConstructorTest() { XSharpProjectFactory myCustomProjectFactory = new XSharpProjectFactory(customProjectPackage); Assert.IsNotNull(myCustomProjectFactory, "Constructor failed"); }