Beispiel #1
0
        public void CheckImagesCountWithWrongPath()
        {
            // Arrage
            int    quantity    = 10;
            int    equalsCount = 0;
            string path        = @"D:\ThermalDetection\ThermalDetection\ThermalData\temp223.tof";

            List <ThermalFile> thermalFiles = new List <ThermalFile>();

            ThermalFile.thermalreader = new MockReader();
            ThermalFile thermalFile = ThermalFile.Read(path);

            // Act
            for (int i = 0; i < quantity; i++)
            {
                thermalFiles.Add(thermalFile);
            }
            ThermalFile brokenThermalFile = DeclareBadThermalFile(thermalFiles[0]);

            brokenThermalFile.path = @"D:\ThermalDetection\Theata\tem23.tof";
            thermalFiles.Add(brokenThermalFile);

            equalsCount = CalculateEqualsItems(thermalFiles);
            // Assert
            Assert.AreEqual(thermalFiles.Count, equalsCount);
        }
Beispiel #2
0
        public void WriteFileTest()
        {
            // Arrage
            List <ThermalFile> thermalFiles = new List <ThermalFile>();

            ThermalFile.thermalreader = new MockReader();

            string path  = @"D:\ThermalDetection\ThermalDetection\ThermalData\temp223.tof";
            string path2 = @"D:\ThermalDetection\ThermalDetection\ThermalData\temp225.tof";

            // Act
            ThermalFile file = ThermalFile.Read(path);

            File.Delete(path2);
            ThermalFile.Write(path2, file);
            ThermalFile file2 = ThermalFile.Read(path2);

            int excepted = 1;

            if (file == file2)
            {
                excepted = 1;
            }
            // Assert
            Assert.AreEqual(1, excepted);
        }
Beispiel #3
0
        public void ComprareThermalFilesWithBrokenImage()
        {
            // Arrage
            int    quantity    = 10;
            int    equalsCount = 0;
            string path        = @"D:\ThermalDetection\ThermalDetection\ThermalData\temp223.tof";

            List <ThermalFile> thermalFiles = new List <ThermalFile>();

            ThermalFile.thermalreader = new MockReader();
            ThermalFile thermalFile = ThermalFile.Read(path);

            // Act
            for (int i = 0; i < quantity; i++)
            {
                thermalFiles.Add(thermalFile);
            }
            ThermalFile badFile = GenerateThermalFileWithBrokenImage(thermalFiles[0]);

            thermalFiles.Add(badFile);

            foreach (var thermal in thermalFiles)
            {
                if (thermal == thermalFiles[1])
                {
                    equalsCount++;
                }
            }
            // Assert
            Assert.AreEqual(quantity, equalsCount);
        }
Beispiel #4
0
        public void NotEqualsThermalFilesWithBrokenPath()
        {
            // Arrage
            int    quantity     = 10;
            int    badComprared = 0;
            string path         = @"D:\ThermalDetection\ThermalDetection\ThermalData\temp223.tof";

            List <ThermalFile> thermalFiles = new List <ThermalFile>();

            ThermalFile.thermalreader = new MockReader();
            ThermalFile thermalFile = ThermalFile.Read(path);

            // Act
            for (int i = 0; i < quantity; i++)
            {
                thermalFiles.Add(thermalFile);
            }
            ThermalFile brokenThermalFile = DeclareBadThermalFile(thermalFiles[0]);

            brokenThermalFile.path = @"D:\ThermalDetection\Theata\tem23.tof";
            thermalFiles.Add(brokenThermalFile);

            foreach (var thermal in thermalFiles)
            {
                if (thermal != thermalFiles[0])
                {
                    badComprared++;
                }
            }

            // Assert
            Assert.AreEqual(0, badComprared);
        }
Beispiel #5
0
 private void loadThermalFile(string path)
 {
     Console.WriteLine("Load Thermal File: " + path);
     thermalFile       = ThermalFile.Read(path);
     imageBox1.Image   = thermalFile.images[0];
     trackBar1.Maximum = thermalFile.count - 1;
     Console.WriteLine();
     Console.WriteLine();
     Console.WriteLine();
     Console.WriteLine();
     Console.WriteLine("Images: " + thermalFile.count);
     Console.WriteLine("min: " + thermalFile.minTemperature);
 }
Beispiel #6
0
        public void ComprareThermalFiles()
        {
            // Arrage
            int    quantity    = 10;
            int    equalsCount = 0;
            string path        = @"D:\ThermalDetection\ThermalDetection\ThermalData\temp223.tof";

            List <ThermalFile> thermalFiles = new List <ThermalFile>();

            ThermalFile.thermalreader = new MockReader();
            ThermalFile thermalFile = ThermalFile.Read(path);

            // Act
            for (int i = 0; i < quantity; i++)
            {
                thermalFiles.Add(thermalFile);
            }
            equalsCount = CalculateEqualsItems(thermalFiles);
            // Assert
            Assert.AreEqual(quantity, equalsCount);
        }