-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnitTestForm.cs
More file actions
66 lines (54 loc) · 2.17 KB
/
UnitTestForm.cs
File metadata and controls
66 lines (54 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using System.Threading;
using System.Windows.Forms;
using Inversions.GUI;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestInversions
{
[TestClass]
public class UnitTestForm
{
[TestMethod]
public void TestFormNumericTextBox2()
{
// Necessitem un fil separat per obrir el formulari i no bloquejar el fil principal del test
Thread thread = new Thread(() =>
{
// Crea una instància del formulari que vols provar
FormNumericTextBox2 form = new FormNumericTextBox2();
// Mostra el formulari
form.ShowDialog();
// Asserts o verificacions (si cal)
Assert.IsNotNull(form);
Assert.AreEqual("UnitTestForm", form.Text);
// Tanca el formulari després de les verificacions
form.Close();
});
// Necessari per a l'execució de formularis en un fil diferent
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join(); // Espera que el fil acabi
}
[TestMethod]
public void TestFormDataGridViewColumnDemo()
{
// Necessitem un fil separat per obrir el formulari i no bloquejar el fil principal del test
Thread thread = new Thread(() =>
{
// Crea una instància del formulari que vols provar
FormDataGridViewColumnDemo form = new FormDataGridViewColumnDemo();
// Mostra el formulari
form.ShowDialog();
// Asserts o verificacions (si cal)
Assert.IsNotNull(form);
Assert.AreEqual("UnitTestForm", form.Text);
// Tanca el formulari després de les verificacions
form.Close();
});
// Necessari per a l'execució de formularis en un fil diferent
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join(); // Espera que el fil acabi
}
}
}