/// <summary>
        ///     Initializes a new instance of the <see cref="AddProjectLinkCommand" /> class.
        ///     Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private AddProjectLinkCommand(ProjectLinkerPackage package)
        {
            _package = package ?? throw new ArgumentNullException(nameof(package));

            if (ServiceProvider.GetService(typeof(IMenuCommandService)) is OleMenuCommandService commandService)
            {
                CommandID   menuCommandID = new CommandID(CommandSet, CommandId);
                MenuCommand menuItem      = new MenuCommand(MenuItemCallback, menuCommandID);
                commandService.AddCommand(menuItem);
            }
        }
Example #2
0
        public void SetSite()
        {
            // Create the package
            IVsPackage package = new ProjectLinkerPackage() as IVsPackage;
            Assert.IsNotNull(package, "The object does not implement IVsPackage");

            // Create a basic service provider
            OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();
            serviceProvider.AddService(typeof(SVsTrackProjectDocuments), new MockDocumentTracker(), true);
            serviceProvider.AddService(typeof(SVsOutputWindow), new MockOutputWindow(), true);
            serviceProvider.AddService(typeof(SVsSolution), new MockIVsSolution(), true);

            // Site the package
            Assert.AreEqual(0, package.SetSite(serviceProvider), "SetSite did not return S_OK");

            // Unsite the package
            Assert.AreEqual(0, package.SetSite(null), "SetSite(null) did not return S_OK");
        }
        public void SetSite()
        {
            // Create the package
            IVsPackage package = new ProjectLinkerPackage();

            Assert.IsNotNull(package, "The object does not implement IVsPackage");

            // Create a basic service provider
            OleServiceProvider serviceProvider = OleServiceProvider.CreateOleServiceProviderWithBasicServices();

            serviceProvider.AddService(typeof(SVsTrackProjectDocuments), new MockDocumentTracker(), true);
            serviceProvider.AddService(typeof(SVsOutputWindow), new MockOutputWindow(), true);
            serviceProvider.AddService(typeof(SVsSolution), new MockIVsSolution(), true);

            // Site the package
            Assert.AreEqual(0, package.SetSite(serviceProvider), "SetSite did not return S_OK");

            // Unsite the package
            Assert.AreEqual(0, package.SetSite(null), "SetSite(null) did not return S_OK");
        }
        public void IsIVsPackage()
        {
            ProjectLinkerPackage package = new ProjectLinkerPackage();

            Assert.IsNotNull(package, "The object does not implement IVsPackage");
        }
 public void CreateInstance()
 {
     ProjectLinkerPackage package = new ProjectLinkerPackage();
 }
 /// <summary>
 ///     Initializes the singleton instance of the command.
 /// </summary>
 /// <param name="package">Owner package, not null.</param>
 public static void Initialize(ProjectLinkerPackage package)
 {
     Instance = new AddProjectLinkCommand(package);
 }
Example #7
0
 public void IsIVsPackage()
 {
     ProjectLinkerPackage package = new ProjectLinkerPackage();
     Assert.IsNotNull(package as IVsPackage, "The object does not implement IVsPackage");
 }
Example #8
0
 public void CreateInstance()
 {
     ProjectLinkerPackage package = new ProjectLinkerPackage();
 }