Esempio n. 1
0
        public void ShouldGetWithKeyIndexer()
        {
            var grid = ExtendedCustomKeyboardEffect.Create();

            grid[Key.Escape] = Color.Red;
            Assert.AreEqual(Color.Red, grid[Key.Escape]);
        }
Esempio n. 2
0
        public void ShouldSetWithIndexIndexer()
        {
            var grid = ExtendedCustomKeyboardEffect.Create();

            grid[5] = Color.Red;

            Assert.AreEqual(Color.Red, grid[5]);
        }
Esempio n. 3
0
        public void ShouldClearToBlack()
        {
            var grid = new ExtendedCustomKeyboardEffect(Color.Pink);

            grid.Clear();

            Assert.That(grid, Is.EqualTo(ExtendedCustomKeyboardEffect.Create()));
        }
Esempio n. 4
0
        public void ShouldNotEqualNull()
        {
            var grid = ExtendedCustomKeyboardEffect.Create();

            Assert.False(grid == null);
            Assert.True(grid != null);
            Assert.AreNotEqual(grid, null);
        }
Esempio n. 5
0
        public void ShouldSetNewColors()
        {
            var grid = ExtendedCustomKeyboardEffect.Create();

            grid[0, 5] = Color.Red;

            Assert.That(grid[0, 5], Is.EqualTo(Color.Red));
        }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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));
                }
            }
        }
Esempio n. 11
0
        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));
                }
            }
        }
Esempio n. 12
0
        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);
        }
Esempio n. 13
0
        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));
        }
Esempio n. 14
0
        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));
        }
Esempio n. 15
0
        public void ShouldGetWithIndexIndexer()
        {
            var grid = new ExtendedCustomKeyboardEffect(Color.Red);

            Assert.AreEqual(Color.Red, grid[3]);
        }