public void searchProductTest() {// arrange SQLiteConnection db = new SQLiteConnection(); db.ConnectionString = "Data Source=D:\\ИАД Курсач\\DataBase.db"; db.Open(); SQLiteCommand command = new SQLiteCommand("INSERT INTO Product VALUES ('00000000', 'tovar')", db); command.ExecuteReader(); db.Close(); string barcode = "00000000"; InformBarcode info = new InformBarcode(); string otvet = "tovar"; // act string result = info.searchProduct(barcode); // assert Assert.AreEqual(result, otvet); db.Open(); SQLiteCommand comm = new SQLiteCommand("DELETE FROM Product WHERE barcode='" + barcode + "'", db); comm.ExecuteReader(); db.Close(); }
public void numberblackTest() { // arrange InformBarcode barcode = new InformBarcode(); Bitmap image = new Bitmap("D:\\ИАД Курсач\\image\\EAN8.gif"); int result; Color[,] All = new Color[image.Width - 1, image.Height - 1]; for (int i = 0; i < (image.Width - 1); i++) { for (int j = 0; j < (image.Height - 1); j++) { All[i, j] = image.GetPixel(i, j); } } // act result = barcode.numberblack(image, All); // assert Assert.AreEqual(result, 22); }