Exemplo n.º 1
0
        public void TestXboxGamepadDisconnectThrowsWhenNotConnected()
        {
            var gamepad = new GamesTest.Xbox.Input.XboxGamepad(this.XboxConsole);

            this.VerifyGamepadThrowsFunc <XboxInputException>(
                () => gamepad.Disconnect(),
                "Disconnect did not throw an exception when not connected.");
        }
Exemplo n.º 2
0
        public void TestXboxGamepadIdSetToInvalidAfterDisconnect()
        {
            this.shimAdapter = new ShimXboxConsoleAdapterBase(new StubXboxConsoleAdapterBase(null))
            {
                DisconnectXboxGamepadStringUInt64 = (systemIpAddress, gamepadId) => { }
            };

            var gamepad = new GamesTest.Xbox.Input.XboxGamepad(this.XboxConsole);

            Assert.IsNotNull(gamepad, "Failed to create gamepad.");
            gamepad.Connect();
            Assert.IsTrue(gamepad.Id >= 0, "Received a bad id, or failed to connect gamepad");

            gamepad.Disconnect();

            Assert.IsNull(gamepad.Id, "Id not set to null after disconnecting");
        }