Exemplo n.º 1
0
        public void IsCorrectLoadOnValues()
        {
            int[,] matrix = new int[4, 4];

            // Define a test input and output value:
            var expectedResult = new int[4, 4];

            //fill the matrix
            expectedResult[0, 0] = 1;
            expectedResult[0, 1] = 0;
            expectedResult[0, 2] = 0;
            expectedResult[0, 3] = 0;
            expectedResult[1, 0] = 0;
            expectedResult[1, 1] = 1;
            expectedResult[1, 2] = 0;
            expectedResult[1, 3] = 0;
            expectedResult[2, 0] = 0;
            expectedResult[2, 1] = 0;
            expectedResult[2, 2] = 1;
            expectedResult[2, 3] = 0;
            expectedResult[3, 0] = 0;
            expectedResult[3, 1] = 0;
            expectedResult[3, 2] = 0;
            expectedResult[3, 3] = 1;
            //
            Level testLevel = new Level();

            testLevel.On      = new int[]  { 0, 5, 10, 15 };
            testLevel.Columns = 4;
            testLevel.Rows    = 4;
            // Run the method under test:
            OperationsHelper.SetOnValues(testLevel, matrix);
            //Verify the result:
            CollectionAssert.AreEqual(expectedResult, matrix);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Set the current level, set the properties and the On matrix values
        /// </summary>
        /// <param name="levelIndex"></param>
        private void SetLevel(int levelIndex)
        {
            CurrentLevel      = LevelsInput[levelIndex];
            CurrentLevelIndex = levelIndex;

            MatrixRows    = CurrentLevel.Rows;
            MatrixColumns = CurrentLevel.Columns;
            LightsMatrix  = new int[MatrixRows, MatrixColumns];
            OperationsHelper.SetOnValues(CurrentLevel, LightsMatrix);
            lblLevel.Content = CurrentLevel.Name;

            PrintMatrix();
        }
Exemplo n.º 3
0
 /// <summary>
 /// reset the current Level to defaults
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnReset_Click(object sender, RoutedEventArgs e)
 {
     OperationsHelper.SetOnValues(CurrentLevel, LightsMatrix);
     ResetControls();
     PrintMatrix();
 }