예제 #1
0
 public void CountGroups_RandomMonitor_NoExceptions(int width, int height)
 {
     try
     {
         DeadPixels deadPixels = new DeadPixels();
         var        monitor    = Monitor.GenerateMonitorPixels(width, height);
         deadPixels.CountGroups(monitor);
     }
     catch (Exception ex)
     {
         Assert.Fail("Expected no exception, but got: " + ex.Message);
     }
 }
예제 #2
0
        public void CountGroups_OnePixelMonitor_OneGroup()
        {
            DeadPixels deadPixels = new DeadPixels();

            char[][] monitor = new char[1][];
            monitor[0] = new char[1] {
                '1'
            };

            int groupsCount = deadPixels.CountGroups(monitor);

            Assert.AreEqual(1, groupsCount);
        }
예제 #3
0
        public void CountGroups_NoDeadPixels_ZeroGroups()
        {
            DeadPixels deadPixels = new DeadPixels();

            char[][] monitor = new char[3][];
            monitor[0] = new char[3] {
                '0', '0', '0'
            };
            monitor[1] = new char[3] {
                '0', '0', '0'
            };
            monitor[2] = new char[3] {
                '0', '0', '0'
            };

            int groupsCount = deadPixels.CountGroups(monitor);

            Assert.AreEqual(0, groupsCount);
        }
예제 #4
0
        public void CountGroups_MonitorExampleTwo_TwoGroups()
        {
            DeadPixels deadPixels = new DeadPixels();

            char[][] monitor = new char[3][];
            monitor[0] = new char[3] {
                '1', '1', '1'
            };
            monitor[1] = new char[3] {
                '1', '0', '0'
            };
            monitor[2] = new char[3] {
                '1', '0', '1'
            };

            int groupsCount = deadPixels.CountGroups(monitor);

            Assert.AreEqual(2, groupsCount);
        }