// check if we need to display config transform in context menu
        private void BeforeQueryStatus(object sender, EventArgs eventArgs)
        {
            try
            {
                var menuCommand = sender as OleMenuCommand;
                if (menuCommand == null)
                {
                    return;
                }

                var dte2         = DTEExtensions.GetInstance();
                var selectedItem = dte2.GetSelectedItem();
                // cache selected config project
                _selectedProjectItem = selectedItem.ProjectItem;
                if (ConfigTransformManager.IsRootConfig(_selectedProjectItem.Name))
                {
                    menuCommand.Visible = true;
                }
                else
                {
                    menuCommand.Visible = false;
                }
            }
            catch (Exception e)
            {
                Trace.WriteLine(string.Format(CultureInfo.CurrentCulture,
                                              "Exception in BeforeQueryStatus() of: {0}. Exception message: {1}", this, e.Message));
            }
        }
예제 #2
0
        public void IsRootConfig_WhenItIsCsFile_ReturnFalse()
        {
            //Arrange
            const string sourceConfigName = CsFile;

            //Act
            var actual = ConfigTransformManager.IsRootConfig(sourceConfigName);

            //Assert
            Assert.IsFalse(actual);
        }
예제 #3
0
        public void IsRootConfig_WhenAnyNameAndConfig_ReturnTrue()
        {
            //Arrange
            const string sourceConfigName = RootAnyConfig;

            //Act
            var actual = ConfigTransformManager.IsRootConfig(sourceConfigName);

            //Assert
            Assert.IsTrue(actual);
        }
예제 #4
0
        public void IsRootConfig_WhenHavingConfigurationInNameAndNotEndingWithConfig_ReturnFalse()
        {
            //Arrange
            const string sourceConfigName = TransformWithoutConfigExtension;

            //Act
            bool actual;

            actual = ConfigTransformManager.IsRootConfig(sourceConfigName);

            //Assert
            Assert.IsFalse(actual);
        }