public void CtrlSTest01()
        {
            var config = ConfigUtil.Deserialize(Resources.TestConfig04);
            var model  = new Model(config, new DummySendKeyCode());
            var vm     = new MainWindowViewModel(model);

            vm.Initialize();
            model.TimerEnabled = false; // 停止させないとステップ実行させたりするとおかしくなる
            model.WindowInfo   = new WindowInfo("ClipStudioPaint.exe",
                                                "新規ファイル.clip - CLIP STUDIO PAINT");
            model.ApplicationGroup.Name.Is("CLIP STUDIO PAINT");
            vm.ApplicationGroupName.Is("CLIP STUDIO PAINT");
            vm.BankName.Is("(default)");
            model.Bank.Entries.Count.Is(2);
            vm.Buttons.Count.Is(5);
            model.Bank.Entries[0].Trigger.Is("S");
            model.Bank.Entries[0].ActionItem.NextBank.Is("曲線");

            var ksLControl = new NativeMethods.KeyboardState
            {
                KeyCode = Keys.LControlKey
            };
            var ksS = new NativeMethods.KeyboardState
            {
                KeyCode = Keys.S
            };

            vm.Event =
                new KeyboardHookedEventArgs(
                    NativeMethods.KeyboardMessage.KeyDown, ref ksLControl);
            model.Bank.Entries.Count.Is(2);
            model.Bank.Name.IsNot("曲線");
            model.Bank.Name.Is("");

            vm.Event =
                new KeyboardHookedEventArgs(
                    NativeMethods.KeyboardMessage.KeyDown, ref ksS);
            model.Bank.Entries.Count.Is(2);
            model.Bank.Name.IsNot("曲線");
            model.Bank.Name.Is("");

            vm.Event =
                new KeyboardHookedEventArgs(
                    NativeMethods.KeyboardMessage.KeyUp, ref ksS);
            model.Bank.Entries.Count.Is(2);
            model.Bank.Name.IsNot("曲線");
            model.Bank.Name.Is("");

            vm.Event =
                new KeyboardHookedEventArgs(
                    NativeMethods.KeyboardMessage.KeyUp, ref ksLControl);
            // これで Bank が "曲線" だとおかしい
            model.Bank.Entries.Count.Is(2);
            model.Bank.Name.IsNot("曲線");
            model.Bank.Name.Is("");
        }
        public void MenuResetTest()
        {
            var config = ConfigUtil.Deserialize(Resources.TestConfig07);

            var model = new Model(config, new DummySendKeyCode());
            var vm    = new MainWindowViewModel(model);

            vm.Initialize();
            model.WindowInfo = new WindowInfo("ClipStudioPaint.exe",
                                              "新規ファイル.clip - CLIP STUDIO PAINT");
            model.ApplicationGroup.Name.Is("CLIP STUDIO PAINT B");
            vm.ApplicationGroupName.Is("CLIP STUDIO PAINT B");
            vm.BankName.Is("(default)");
            vm.Buttons.Count.Is(3);
            vm.Buttons[2].Key.Is("NumPad3");
            vm.Buttons[2].LabelText.Is("メニューB");
            vm.Buttons[2].ActionItem.ActionType.Is(ActionType.Menu);
            vm.Buttons[2].ActionItem.ActionValue.Is("menu01");
            vm.Buttons[2].ActionItem.NextBank.IsNull();

            model.ProcAction(vm.Buttons[2].ActionItem,
                             NativeMethods.KeyboardUpDown.Down);
            model.ProcAction(vm.Buttons[2].ActionItem,
                             NativeMethods.KeyboardUpDown.Up);

            model.IsMenuVisible.Is(true);
            model.Menu.Name.Is("menu01");
            model.Menu.MenuItem.Count.Is(2);

            vm.BankName.Is("(default)");
            model.Bank.Name.Is("");
            model.Bank.Entries.Count.Is(4);
            model.Bank.Entries[3].LabelText.Is("キャンセル");
            model.Bank.Entries[3].Trigger.Is("NumPad5");
            model.Bank.Entries[3].ActionItem.ActionType.Is(ActionType.System);
            model.Bank.Entries[3].ActionItem.ActionValue.Is("Cancel");

            var state = new NativeMethods.KeyboardState
            {
                KeyCode = Keys.NumPad5
            };

            vm.Event =
                new KeyboardHookedEventArgs(
                    NativeMethods.KeyboardMessage.KeyDown, ref state);
            vm.Event =
                new KeyboardHookedEventArgs(
                    NativeMethods.KeyboardMessage.KeyUp, ref state);
            vm.BankName.Is("(default)");
            model.IsMenuVisible.Is(false);
        }
        public void BankResetTest()
        {
            var config = ConfigUtil.Deserialize(Resources.TestConfig07);
            var model  = new Model(config, new DummySendKeyCode());
            var vm     = new MainWindowViewModel(model);

            vm.Initialize();
            model.WindowInfo = new WindowInfo("ClipStudioPaint.exe",
                                              "新規ファイル.clip - CLIP STUDIO PAINT");
            model.ApplicationGroup.Name.Is("CLIP STUDIO PAINT B");
            vm.ApplicationGroupName.Is("CLIP STUDIO PAINT B");
            vm.BankName.Is("(default)");
            vm.Buttons.Count.Is(3);
            vm.Buttons[0].Key.Is("NumPad9");
            vm.Buttons[0].LabelText.Is("前景B");
            vm.Buttons[0].ActionItem.ActionType.Is(ActionType.Send);
            vm.Buttons[0].ActionItem.ActionValue.Is(" B");
            vm.Buttons[0].ActionItem.NextBank.Is("曲線");
            model.ProcAction(vm.Buttons[0].ActionItem,
                             NativeMethods.KeyboardUpDown.Down);
            model.ProcAction(vm.Buttons[0].ActionItem,
                             NativeMethods.KeyboardUpDown.Up);

            // "曲線" Bank の Entries[2] に
            // システムコマンド Cancel が設定されていることを確認
            vm.BankName.Is("曲線");
            model.Bank.Entries.Count.Is(3);
            model.Bank.Entries[2].LabelText.Is("キャンセル");
            model.Bank.Entries[2].Trigger.Is("NumPad5");
            model.Bank.Entries[2].ActionItem.ActionType.Is(ActionType.System);
            model.Bank.Entries[2].ActionItem.ActionValue.Is("Cancel");
            model.Bank.Entries[2].ActionItem.NextBank.IsNull();

            // Cancel を呼び出す
            var state = new NativeMethods.KeyboardState
            {
                KeyCode = Keys.NumPad5
            };

            vm.Event =
                new KeyboardHookedEventArgs(
                    NativeMethods.KeyboardMessage.KeyDown, ref state);
            vm.Event =
                new KeyboardHookedEventArgs(
                    NativeMethods.KeyboardMessage.KeyUp, ref state);

            // Bank がリセットされていればOK
            vm.BankName.Is("(default)");
        }