public void TestPairWithMethodsPassOnIds() { const uint ExpectedUserId = TestUserId; const ulong ExpectedGamepadId = 9876543210; var gamepad = new XboxGamepad(this.xboxConsole); XboxUser user = this.CreateTestUser(); ShimXboxConsoleAdapterBase.AllInstances.ConnectXboxGamepadString = (_, __) => ExpectedGamepadId; gamepad.Connect(); ShimXboxConsoleAdapterBase.AllInstances.PairGamepadToUserStringUInt64UInt32 = (adapter, systemIpAddress, gamepadId, userId) => { Assert.AreEqual(ExpectedGamepadId, gamepadId, "The XboxUser did not pass in the expected id parameter"); Assert.AreEqual(ExpectedUserId, userId, "The XboxUser did not pass in the expected id parameter"); }; user.PairWithPhysicalController(ExpectedGamepadId); user.PairWithVirtualController(gamepad); }
public void TestPairWithMethodsCallAdapterPairGamepadToUser() { var gamepad = new XboxGamepad(this.xboxConsole); gamepad.Connect(); XboxUser user = this.CreateTestUser(); bool isCorrectMethodCalled = false; ShimXboxConsoleAdapterBase.AllInstances.PairGamepadToUserStringUInt64UInt32 = (adapter, systemIpAddress, gamepadId, userId) => { isCorrectMethodCalled = true; }; user.PairWithPhysicalController(0); Assert.IsTrue(isCorrectMethodCalled, "The PairWithPhysicalController method didn't call the adapter's PairGamepadToUser(systemIpAddress, gamepadId, userId)."); isCorrectMethodCalled = false; user.PairWithVirtualController(gamepad); Assert.IsTrue(isCorrectMethodCalled, "The PairWithVirtualController method didn't call the adapter's PairGamepadToUser(systemIpAddress, gamepadId, userId)."); }