public void ShouldGetWithKeyIndexer() { var grid = ExtendedCustomKeyboardEffect.Create(); grid[Key.Escape] = Color.Red; Assert.AreEqual(Color.Red, grid[Key.Escape]); }
public void ShouldSetWithIndexIndexer() { var grid = ExtendedCustomKeyboardEffect.Create(); grid[5] = Color.Red; Assert.AreEqual(Color.Red, grid[5]); }
public void ShouldClearToBlack() { var grid = new ExtendedCustomKeyboardEffect(Color.Pink); grid.Clear(); Assert.That(grid, Is.EqualTo(ExtendedCustomKeyboardEffect.Create())); }
public void ShouldNotEqualNull() { var grid = ExtendedCustomKeyboardEffect.Create(); Assert.False(grid == null); Assert.True(grid != null); Assert.AreNotEqual(grid, null); }
public void ShouldSetNewColors() { var grid = ExtendedCustomKeyboardEffect.Create(); grid[0, 5] = Color.Red; Assert.That(grid[0, 5], Is.EqualTo(Color.Red)); }
public void ShouldNotEqualArbitraryObject() { var grid = ExtendedCustomKeyboardEffect.Create(); var obj = new object(); Assert.False(grid == obj); Assert.True(grid != obj); Assert.False(grid.Equals(obj)); Assert.AreNotEqual(grid, obj); }
public void ShouldNotEqual2DArrayWithInvalidRowCount() { var grid = ExtendedCustomKeyboardEffect.Create(); var arr = new Color[2][]; Assert.False(grid == arr); Assert.True(grid != arr); Assert.False(grid.Equals(arr)); Assert.AreNotEqual(grid, arr); }
public void ShouldNotEqualDifferentGrid() { var a = new ExtendedCustomKeyboardEffect(Color.Red); var b = new ExtendedCustomKeyboardEffect(Color.Pink); Assert.False(a == b); Assert.True(a != b); Assert.False(a.Equals(b)); Assert.AreNotEqual(a, b); }
public void ShouldEqualIdenticalGrid() { var a = new ExtendedCustomKeyboardEffect(Color.Red); var b = new ExtendedCustomKeyboardEffect(Color.Red); Assert.True(a == b); Assert.False(a != b); Assert.True(a.Equals(b)); Assert.AreEqual(a, b); }
public void ShouldSetAllColorsWithColorCtor() { var grid = new ExtendedCustomKeyboardEffect(Color.Red); for (var row = 0; row < KeyboardConstants.MaxExtendedRows; row++) { for (var column = 0; column < KeyboardConstants.MaxExtendedColumns; column++) { Assert.That(grid[row, column], Is.EqualTo(Color.Red)); } } }
public void ShouldSetToBlackWithCreate() { var grid = ExtendedCustomKeyboardEffect.Create(); for (var row = 0; row < KeyboardConstants.MaxExtendedRows; row++) { for (var column = 0; column < KeyboardConstants.MaxExtendedColumns; column++) { Assert.That(grid[row, column], Is.EqualTo(Color.Black)); } } }
public void ShouldNotEqualDifferent2DArray() { var grid = new ExtendedCustomKeyboardEffect(Color.Pink); var arr = new Color[KeyboardConstants.MaxExtendedRows][]; // Populate the 2D array for (var row = 0; row < KeyboardConstants.MaxExtendedRows; row++) { arr[row] = new Color[KeyboardConstants.MaxExtendedColumns]; for (var col = 0; col < KeyboardConstants.MaxExtendedColumns; col++) { arr[row][col] = Color.Red; } } Assert.False(grid == arr); Assert.True(grid != arr); Assert.False(grid.Equals(arr)); Assert.AreNotEqual(grid, arr); }
public void ShouldThrowWhenOutOfRange1DSet() { var grid = ExtendedCustomKeyboardEffect.Create(); Assert.That( () => grid[-1] = Color.Red, Throws.InstanceOf <ArgumentOutOfRangeException>() .With.Property("ParamName") .EqualTo("index") .And.Property("ActualValue") .EqualTo(-1)); Assert.That( () => grid[KeyboardConstants.MaxExtendedKeys] = Color.Red, Throws.InstanceOf <ArgumentOutOfRangeException>() .With.Property("ParamName") .EqualTo("index") .And.Property("ActualValue") .EqualTo(KeyboardConstants.MaxExtendedKeys)); }
public void ShouldThrowWhenOutOfRange2DGet() { var grid = ExtendedCustomKeyboardEffect.Create(); // ReSharper disable once NotAccessedVariable Color dummy; Assert.That( () => dummy = grid[-1, 0], Throws.InstanceOf <ArgumentOutOfRangeException>() .With.Property("ParamName") .EqualTo("row") .And.Property("ActualValue") .EqualTo(-1)); Assert.That( () => dummy = grid[KeyboardConstants.MaxExtendedRows, 0], Throws.InstanceOf <ArgumentOutOfRangeException>() .With.Property("ParamName") .EqualTo("row") .And.Property("ActualValue") .EqualTo(KeyboardConstants.MaxExtendedRows)); Assert.That( () => dummy = grid[0, -1], Throws.InstanceOf <ArgumentOutOfRangeException>() .With.Property("ParamName") .EqualTo("column") .And.Property("ActualValue") .EqualTo(-1)); Assert.That( () => dummy = grid[0, KeyboardConstants.MaxExtendedColumns], Throws.InstanceOf <ArgumentOutOfRangeException>() .With.Property("ParamName") .EqualTo("column") .And.Property("ActualValue") .EqualTo(KeyboardConstants.MaxExtendedColumns)); }
public void ShouldGetWithIndexIndexer() { var grid = new ExtendedCustomKeyboardEffect(Color.Red); Assert.AreEqual(Color.Red, grid[3]); }