예제 #1
0
        public void CreateInstance()
        {
            Guid           commandGuid = new Guid();
            int            commandId   = 42;
            CommandID      id          = new CommandID(commandGuid, commandId);
            string         text        = "Test DynamicTextCommand";
            OleMenuCommand command     = DynamicTextCommandWrapper.GetDynamicTextCommandInstance(id, text);

            Assert.AreEqual(commandGuid, command.CommandID.Guid, "Guid not correct for the DynamicTextCommand.");
            Assert.AreEqual(commandId, command.CommandID.ID, "ID not correct for the DynamicTextCommand.");
        }
예제 #2
0
        public void CheckText()
        {
            OleMenuCommand command = DynamicTextCommandWrapper.GetDynamicTextCommandInstance(
                new CommandID(new Guid(), 77),
                "Test");
            string returnedText = command.Text;

            Assert.AreEqual("Test (Clicked 0 times)", returnedText, "Text not correct before first click.");

            // Simulate the click calling invoke.
            command.Invoke(null);
            // Get the new text
            returnedText = command.Text;
            Assert.AreEqual("Test (Clicked 1 times)", returnedText, "Text not correct after first click.");
        }