public void ClearDatabaseTest() { InstanceContext context = new InstanceContext(this); ServiceReference1.ServiceClient Proxy = new ServiceReference1.ServiceClient(context); Proxy.ClearAllDatabases(); }
public void addEntries() { bool yes = true; InstanceContext context = new InstanceContext(this); ServiceReference1.ServiceClient Proxy = new ServiceReference1.ServiceClient(context); string[] lines = System.IO.File.ReadAllLines(@"C:\Users\duncanc\Documents\WriteLines.txt"); //Proxy.AddAppletEntry(z); for (int i = 0; i < 5000; i++) { DataBaseEntry x; string[] parts = lines[0].Split(':'); if (yes) { x = new DataBaseEntry(parts[0], "SessionUnlock", parts[2], parts[3], parts[4], parts[5], DateTime.Now, false, false, new TimeSpan(0, 0, 0)); } else { x = new DataBaseEntry(parts[0], "SessionLock", parts[2], parts[3], parts[4], parts[5], DateTime.Now, false, false, new TimeSpan(0, 5, 0)); } yes = !yes; Proxy.AddAppletEntry(x); } }
public void addUserTest() { InstanceContext context = new InstanceContext(this); ServiceReference1.ServiceClient Proxy = new ServiceReference1.ServiceClient(context); User devSuc = new User(); devSuc.UserID = "a"; devSuc.UserName = "******"; bool success = Proxy.AddUser(devSuc); Assert.IsTrue(success); devSuc = new User(); devSuc.UserID = "b"; devSuc.UserName = "******"; success = Proxy.AddUser(devSuc); Assert.IsTrue(success); devSuc = new User(); devSuc.UserID = "c"; devSuc.UserName = "******"; success = Proxy.AddUser(devSuc); Assert.IsTrue(success); /* * User devfail = new User(); * devfail.UserID = "a"; * devfail.UserName = "******"; * bool fail = Proxy.AddUser(devfail); * Assert.IsFalse(fail); */ }
public void addDeviceTestTwo() { //AFKHostedService.AFKHostedService Proxy = new AFKHostedService.AFKHostedService(); InstanceContext context = new InstanceContext(this); ServiceReference1.ServiceClient Proxy = new ServiceReference1.ServiceClient(context); Device devFail = new Device("a", "a", "a", "a", false); bool failure = Proxy.AddDevice(devFail); Assert.IsFalse(failure); }
public void addDeviceTestOne() { string name = RandomNameGenerator.NameGenerator.Generate(RandomNameGenerator.Gender.Male); //AFKHostedService.AFKHostedService Proxy = new AFKHostedService.AFKHostedService(); InstanceContext context = new InstanceContext(this); ServiceReference1.ServiceClient Proxy = new ServiceReference1.ServiceClient(context); Device devSuc = new Device("a", "a", "a", "a", false); bool success = Proxy.AddDevice(devSuc); Assert.IsTrue(success); devSuc = new Device("b", "b", "b", "b", false); success = Proxy.AddDevice(devSuc); Assert.IsTrue(success); devSuc = new Device("c", "c", "c", "c", false); success = Proxy.AddDevice(devSuc); Assert.IsTrue(success); }
public void addDevices() { InstanceContext context = new InstanceContext(this); ServiceReference1.ServiceClient Proxy = new ServiceReference1.ServiceClient(context); System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\duncanc\Documents\WriteLines.txt"); for (int i = 0; i < 80; i++) { string name = RandomNameGenerator.NameGenerator.Generate(RandomNameGenerator.Gender.Male); const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; Random r = new Random(); string ID = new string(Enumerable.Repeat(chars, 20).Select(s => s[r.Next(s.Length)]).ToArray()); string deviceID = new string(Enumerable.Repeat(chars, 20).Select(s => s[r.Next(s.Length)]).ToArray()); string deviceName = new string(Enumerable.Repeat(chars, 8).Select(s => s[r.Next(s.Length)]).ToArray()); Device devSuc = new Device(deviceID, deviceName, ID, name, false); Proxy.AddDevice(devSuc); string sessionID = new string(Enumerable.Repeat(chars, 20).Select(s => s[r.Next(s.Length)]).ToArray()); DataBaseEntry z = new DataBaseEntry(name, "SessionUnlock", ID, deviceID, deviceName, sessionID, DateTime.Now, false, false, new TimeSpan(0, 0, 0)); file.WriteLine(z.UserName + ":" + z.EventType + ":" + z.UserID + ":" + z.DeviceID + ":" + z.MachineName + ":" + z.SessionID + ":" + z.TimeOfEvent + ":" + z.AutomaticLock + ":" + z.RemoteAccess + ":" + z.ETA); } }