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 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 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); } }