Exemplo n.º 1
0
        public void StartAndStopAreNotReentrant()
        {
            using var mkw = new ModifierKeysWatcher(new NativeMethodsMock());

            bool IsRunning() => mkw.GetPrivateField <bool>("_running");

            Assert.False(IsRunning());

            mkw.Start();
            Assert.True(IsRunning());

            mkw.Start();
            Assert.True(IsRunning());

            mkw.Stop();
            Assert.False(IsRunning());

            mkw.Stop();
            Assert.False(IsRunning());
        }