public void TestGetIfExists() { var ints = new List <int>(new int[] { 10, 20, 30, 40 }); Assert.AreEqual(10, CollectionHelper.GetIfExists(ints, 0)); Assert.AreEqual(20, CollectionHelper.GetIfExists(ints, 1)); Assert.AreEqual(30, CollectionHelper.GetIfExists(ints, 2)); Assert.AreEqual(40, CollectionHelper.GetIfExists(ints, 3)); Assert.AreEqual(0, CollectionHelper.GetIfExists(ints, 4)); Assert.AreEqual(0, CollectionHelper.GetIfExists(ints, 5)); }
/// <summary>Returns the keyboard on a PC</summary> /// <returns>The keyboard</returns> public IKeyboard GetKeyboard() { return(CollectionHelper.GetIfExists(this.keyboards, 4)); }
/// <summary>Returns the primary mouse input device</summary> /// <returns>The primary mouse</returns> public IMouse GetMouse() { return(CollectionHelper.GetIfExists(this.mice, 0)); }
/// <summary>Returns the keyboard on a PC</summary> /// <returns>The keyboard</returns> IKeyboard IInputService.GetKeyboard() { return(CollectionHelper.GetIfExists(this.keyboards, 4)); }
/// <summary>Returns the primary mouse input device</summary> /// <returns>The primary mouse</returns> IMouse IInputService.GetMouse() { return(CollectionHelper.GetIfExists(this.mice, 0)); }