source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/BMX41000/IHS BMX Framework/IndianHealthService.BMXNet.Test/BmxBaseTestSuite.cs@ 1742

Last change on this file since 1742 was 1146, checked in by Sam Habiel, 14 years ago

Initial Import of BMX4

File size: 3.4 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Text;
4using NUnit.Framework;
5using System.Data;
6using IndianHealthService.BMXNet.Model;
7using IndianHealthService.BMXNet.WinForm.Configuration;
8using IndianHealthService.BMXNet.WinForm;
9using System.Threading;
10
11namespace IndianHealthService.BMXNet.Tests
12{
13
14 /// <summary>
15 /// BMX ADO SS^BMX TEST FILE^^~~~~~
16 ///
17 /// </summary>
18 ///
19
20 public abstract class BmxBaseTestSuite
21 {
22
23 public void Hang(int aNumberOfSeconds)
24 {
25 Thread.Sleep(aNumberOfSeconds * 1000);
26 }
27
28 private TestUser _user = null;
29
30 public TestUser User
31 {
32 get { return _user; }
33 set { _user = value; }
34 }
35
36
37 private WinFramework _framework = null;
38
39 public WinFramework Framework
40 {
41 get { return _framework; }
42 set { _framework = value; }
43 }
44 private LoginProcess _loginProcess = null;
45
46 public LoginProcess LoginProcess
47 {
48 get { return _loginProcess; }
49 set { _loginProcess = value; }
50 }
51 private RpmsConnectionSpec _connectionSpec = null;
52
53 public RpmsConnectionSpec ConnectionSpec
54 {
55 get { return _connectionSpec; }
56 set { _connectionSpec = value; }
57 }
58
59 private RemoteSession _remoteSession = null;
60
61 public RemoteSession RemoteSession
62 {
63 get { return _remoteSession; }
64 set { _remoteSession = value; }
65 }
66
67
68
69 public RemoteSession OpenConnection(TestUser aUser)
70 {
71 this.Framework = new WinFramework();
72 this.LoginProcess = this.Framework.CreateLoginProcess();
73
74 if (aUser.Login(this.LoginProcess))
75 {
76 this.RemoteSession = this.Framework.PrimaryRemoteSession;
77 }
78 return this.RemoteSession;
79 }
80
81 [TearDown]
82 public void CloseFramework()
83 {
84 if (this.Framework != null)
85 {
86 this.Framework.Close();
87 this.Framework = null;
88 }
89 this.LoginProcess = null;
90 this.RemoteSession = null;
91 }
92
93 protected String _fetchTableString = "BMX ADO SS^BMX TEST FILE^^~~~~~";
94
95 public String FetchTableString
96 {
97 get { return _fetchTableString; }
98 set { _fetchTableString = value; }
99 }
100
101 [SetUp]
102 public virtual void Setup()
103 {
104 this.SetupConnection();
105 }
106
107 public abstract void SetupTestUser();
108
109 public virtual void SetupConnection()
110 {
111 this.SetupTestUser();
112 this.OpenConnection(this.User);
113 }
114
115 public virtual void SetupTable()
116 {
117
118 }
119
120 public virtual void ClearTable()
121 {
122 DataTable table = this.RemoteSession.TableFromCommand(this.FetchTableString);
123
124 foreach (DataRow each in table.Rows)
125 {
126 each.Delete();
127 }
128 this.RemoteSession.SaveChanges(table);
129
130 table = this.RemoteSession.TableFromCommand(this.FetchTableString);
131 Assert.AreEqual(0, table.Rows.Count);
132 }
133
134
135
136 }
137}
Note: See TracBrowser for help on using the repository browser.