public void SetLocationTest() { Setup(); // Set up a device PairableDevice device = new PairableDevice { Identifier = "myPad", Location = new Point(1, 1) }; Server.Locator.Devices.Add(device); Server.Start(); Client.Start(); WaitForConnections(); // Build a request to set the device's orientation IARequest request = new IARequest(Routes.SetOrientationRoute); request.Parameters["identifier"] = "myPad"; Point newLocation = new Point(2, 2); request.SetBodyWith(new IntermediatePoint(newLocation)); // Send the request, and test Client.SendRequest(request, Server.IntAirAct.OwnDevice, delegate(IAResponse response, Exception exception) { Assert.AreEqual(newLocation, device.Location.Value); }); Teardown(); }
public void onLocationChanged(Device device) { PairableDevice pairableDevice = (PairableDevice)device; //Dispatch UI Changes to Main Thread Application.Current.Dispatcher.BeginInvoke(new Action(() => { if (pairableDevice.Location.HasValue) { if (iaDevice.SupportedRoutes.Contains(Routes.GetLocationRoute)) { MyDisplayState = DisplayState.LocatedAndOnStackPanel; } Point newPoint = DrawingResources.ConvertFromMetersToDisplayCoordinates(pairableDevice.Location.Value, MainWindow.SharedCanvas); // InnerBorder.Width / 2 is to make it so that the point that the DeviceControl is drawn at is actually the center of the Border Canvas.SetLeft(this, newPoint.X - (InnerBorder.Width / 2)); Canvas.SetTop(this, newPoint.Y - (InnerBorder.Height / 2)); } else if (iaDevice.SupportedRoutes.Contains(Routes.GetLocationRoute)) { MyDisplayState = DisplayState.UnlocatedAndOnStackPanel; } })); }
public void SetOrientationTest() { Setup(); // Set up a device PairableDevice device = new PairableDevice { Identifier = "myPad", Orientation = 20.0 }; Server.Locator.Devices.Add(device); Server.Start(); Client.Start(); WaitForConnections(); // Build a request to set the device's orientation IARequest request = new IARequest(Routes.SetOrientationRoute); request.Parameters["identifier"] = "myPad"; double newOrientation = 240.0; request.SetBodyWithString(newOrientation.ToString()); // Send the request, and test Client.SendRequest(request, Server.IntAirAct.OwnDevice, delegate(IAResponse response, Exception exception) { Assert.AreEqual(240.0, device.Orientation.Value, 0.01); }); Teardown(); }
public void onOrientationChanged(Device device) { PairableDevice pairableDevice = (PairableDevice)device; // Draw two lines to serve as field of view indicators double topAngle = Util.NormalizeAngle(pairableDevice.Orientation.Value + pairableDevice.FieldOfView.Value); double topX = Math.Cos(topAngle * Math.PI / 180); double topY = Math.Sin(topAngle * Math.PI / 180); double bottomAngle = Util.NormalizeAngle(pairableDevice.Orientation.Value - pairableDevice.FieldOfView.Value); double bottomX = Math.Cos(bottomAngle * Math.PI / 180); double bottomY = Math.Sin(bottomAngle * Math.PI / 180); Point newLeft = DrawingResources.ConvertPointToProperLength(new Point(topX, topY), DrawingResources.DEVICE_FOV_LENGTH); Point newRight = DrawingResources.ConvertPointToProperLength(new Point(bottomX, bottomY), DrawingResources.DEVICE_FOV_LENGTH); //Dispatch UI Changes to Main Thread Application.Current.Dispatcher.BeginInvoke(new Action(() => { LeftLine.X2 = newLeft.X; LeftLine.Y2 = -newLeft.Y; RightLine.X2 = newRight.X; RightLine.Y2 = -newRight.Y; if (pairableDevice.PairingState == PairingState.Paired) { LeftLine.Visibility = System.Windows.Visibility.Visible; RightLine.Visibility = System.Windows.Visibility.Visible; } })); }
public void GetDeviceInfoTest() { Setup(); PairableDevice deviceOne = new PairableDevice { Location = new Point(1, 0), Orientation = 90, Identifier = "deviceOne", }; PairableDevice deviceTwo = new PairableDevice { Location = new Point(-1, 0), Identifier = "deviceTwo", }; Server.Locator.Devices.Add(deviceOne); Server.Locator.Devices.Add(deviceTwo); Server.Start(); Client.Start(); WaitForConnections(); // Successful get device info test IARequest request = new IARequest(Routes.GetDeviceInfoRoute); request.Parameters["identifier"] = deviceOne.Identifier; Client.SendRequest(request, Server.IntAirAct.OwnDevice, delegate(IAResponse response, Exception e) { IntermediateDevice id = response.BodyAs <IntermediateDevice>(); Assert.AreEqual("deviceOne", id.identifier); Assert.AreEqual(new Point(1, 0), id.location.Value); Assert.AreEqual(90.0, id.orientation.Value, 0.01); doneWaitingForResponse = true; }); WaitForResponse(); doneWaitingForResponse = false; // Unsuccessful get device info test // Device two is incomplete, missing orientation, the correct server behaviour is to return http status 404 request = new IARequest(Routes.GetDeviceInfoRoute); request.Parameters["identifier"] = deviceTwo.Identifier; Client.SendRequest(request, Server.IntAirAct.OwnDevice, delegate(IAResponse response, Exception e) { Assert.AreEqual(404, response.StatusCode); doneWaitingForResponse = true; }); WaitForResponse(); Teardown(); }
public void AllDevicesInViewTest() { Setup(); PairableDevice observer = new PairableDevice { Location = new Point(0, 0), Orientation = 225, Identifier = "observer", }; PairableDevice nearest = new PairableDevice { Location = new Point(-1, -1), Identifier = "nearest", Orientation = 20, }; PairableDevice furthest = new PairableDevice { Location = new Point(-2, -2), Identifier = "furthest", Orientation = 20, }; Server.Locator.Devices.Add(observer); Server.Locator.Devices.Add(furthest); Server.Locator.Devices.Add(nearest); Server.Start(); Client.Start(); WaitForConnections(); IARequest request = new IARequest(Routes.GetAllDevicesInViewRoute); request.Parameters["identifier"] = observer.Identifier; Client.SendRequest(request, Server.IntAirAct.OwnDevice, delegate(IAResponse response, Exception e) { List <IntermediateDevice> intDevices = response.BodyAs <IntermediateDevice>(); IntermediateDevice intDevice = intDevices.Find(x => x.identifier == nearest.Identifier); Assert.AreEqual(nearest.Location, intDevice.location); Assert.AreEqual(nearest.Orientation, intDevice.orientation); intDevice = intDevices.Find(x => x.identifier == furthest.Identifier); Assert.AreEqual(furthest.Location, intDevice.location); Assert.AreEqual(furthest.Orientation, intDevice.orientation); doneWaitingForResponse = true; }); WaitForResponse(); Teardown(); }
internal PairableDevice CreateTestDevice(int newId, int?heldById = null) { PairableDevice device = new PairableDevice { Identifier = newId.ToString(), HeldByPersonIdentifier = heldById.ToString() ?? null, PairingState = PairingState.NotPaired }; return(device); }
public void NearestDeviceInRangeTest() { Setup(); PairableDevice observer = new PairableDevice { Location = new Point(10, 10), Orientation = 0, Identifier = "observer", }; PairableDevice nearest = new PairableDevice { Location = new Point(0, 5), Identifier = "nearest", Orientation = 0, }; PairableDevice furthest = new PairableDevice { Location = new Point(-5, 0), Identifier = "furthest", Orientation = 0, }; Server.Locator.Devices.Add(observer); Server.Locator.Devices.Add(furthest); Server.Locator.Devices.Add(nearest); Server.Start(); Client.Start(); WaitForConnections(); IARequest request = new IARequest(Routes.GetNearestDeviceInRangeRoute); request.Parameters["identifier"] = observer.Identifier; request.Parameters["range"] = "100.0"; Client.SendRequest(request, Server.IntAirAct.OwnDevice, delegate(IAResponse response, Exception e) { IntermediateDevice intDevice = response.BodyAs <IntermediateDevice>(); Assert.AreEqual(nearest.Identifier, intDevice.identifier); Assert.AreEqual(nearest.Location, intDevice.location); Assert.AreEqual(nearest.Orientation, intDevice.orientation); doneWaitingForResponse = true; }); WaitForResponse(); Teardown(); }
void deviceRemoved(DeviceManager deviceManager, PairableDevice pairableDevice) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { if (DeviceControlDictionary.ContainsKey(pairableDevice.Identifier)) { canvas.Children.Remove(DeviceControlDictionary[pairableDevice.Identifier]); unpairedDeviceStackPanel.Children.Remove(DeviceControlDictionary[pairableDevice.Identifier]); surfaceStackPanel.Children.Remove(DeviceControlDictionary[pairableDevice.Identifier]); DeviceControlDictionary.Remove(pairableDevice.Identifier); } })); }
public void GetAllDeviceInfoTest() { Setup(); PairableDevice deviceOne = new PairableDevice { Location = new Point(1, 0), Orientation = 90, Identifier = "deviceOne", }; PairableDevice deviceTwo = new PairableDevice { Location = new Point(-1, 0), Identifier = "deviceTwo", Orientation = 20, }; Server.Locator.Devices.Add(deviceOne); Server.Locator.Devices.Add(deviceTwo); Server.Start(); Client.Start(); WaitForConnections(); IARequest request = new IARequest(Routes.GetAllDeviceInfoRoute); Client.SendRequest(request, Server.IntAirAct.OwnDevice, delegate(IAResponse response, Exception e) { List <IntermediateDevice> ids = response.BodyAs <IntermediateDevice>(); IntermediateDevice intDevice = ids.Find(x => x.identifier.Equals("deviceOne")); Assert.AreEqual(deviceOne.Location, intDevice.location); Assert.AreEqual(deviceOne.Orientation, intDevice.orientation.Value); intDevice = ids.Find(x => x.identifier.Equals("deviceTwo")); Assert.AreEqual(deviceTwo.Location, intDevice.location); Assert.AreEqual(deviceTwo.Orientation, intDevice.orientation.Value); doneWaitingForResponse = true; }); WaitForResponse(); Teardown(); }
public void GetOffsetAngleTest() { Setup(); // Create a person and device, paired and positioned PairablePerson person = new PairablePerson { PairingState = PairingState.Paired, Identifier = "Bob", Location = new Point(1, 1), HeldDeviceIdentifier = "myPad" }; PairableDevice device = new PairableDevice { HeldByPersonIdentifier = "Bob", Identifier = "myPad", Location = new Point(1, 1), PairingState = PairingState.Paired }; // Position the tracker //Server.PersonManager.Tracker.Location = new Point(0, 2); //Server.PersonManager.Tracker.Orientation = 270; Server.Locator.Devices.Add(device); Server.Locator.Persons.Add(person); Server.Start(); Client.Start(); WaitForConnections(); IARequest request = new IARequest(Routes.GetOffsetAngleRoute); request.Parameters["identifier"] = "myPad"; Client.SendRequest(request, Server.IntAirAct.OwnDevice, delegate(IAResponse response, Exception exception) { double offsetOrientation = double.Parse(response.BodyAsString()); // The angle between the device and the tracker should be 135 degrees Assert.AreEqual(135, offsetOrientation, 0.01); }); Teardown(); }
public void SuccessfulPairingTest() { Setup(); // Setup the 'became paired' route on the client. Client.Route(Routes.BecomePairedRoute, delegate(IARequest request, IAResponse response) { // In response to receiving 'became paired', we test some properties on the server // Find the mock pairable person we created, test their pairing state PairablePerson person = (PairablePerson)Server.Locator.Persons.Find(x => x.Identifier.Equals("Bob")); Assert.AreEqual(PairingState.Paired, person.PairingState); // Find the Client's IADevice on the server, test its pariing state PairableDevice device = (PairableDevice)Server.Locator.Devices.Find(x => x.Identifier.Equals(Client.OwnDevice.Name)); Assert.AreEqual(PairingState.Paired, device.PairingState); // Test that the two were paired with each other Assert.AreEqual(person.HeldDeviceIdentifier, device.Identifier); Assert.AreEqual(device.HeldByPersonIdentifier, person.Identifier); doneWaitingForResponse = true; }); Server.Start(); Client.Start(); WaitForConnections(); // Create a person on the server, who is attempting to pair their device // NB: Setting PairingAttempt on a person begins a 3 second timer, after which it resets to NotPaired // The test should always complete before then, though Server.Locator.Persons.Add(new PairablePerson() { Identifier = "Bob", Location = new System.Windows.Point(1, 1), PairingState = PairingState.PairingAttempt }); // Notify the server that the client wants to be paired Client.SendRequest(new IARequest(Routes.RequestPairingRoute), Server.IntAirAct.OwnDevice); WaitForResponse(); Teardown(); }
public void onPairingStateChanged(PairableDevice pairableDevice) { //Dispatch UI Changes to Main Thread Application.Current.Dispatcher.BeginInvoke(new Action(() => { //Set device border to appropriate colour InnerBorder.BorderBrush = DrawingResources.GetBrushFromPairingState(pairableDevice.PairingState); //Set the control's owner if (pairableDevice.PairingState == PairingState.Paired) { // When paired, we move the device to the canvas. this.MyDisplayState = DisplayState.PairedAndOnCanvas; } else { // If we are not paired or in pairing attempt, we go to stackpanel this.MyDisplayState = DisplayState.UnpairedAndOnStackPanel; } })); }
public void CastingTest() { //Create A List of Pairable Devices List <Device> listOfDevices = new List <Device>(); //Add Devices to List String testIdentifier = "ChrisBurnsiPhone"; PairableDevice pairableDevice = new PairableDevice { Identifier = testIdentifier, Orientation = null, PairingState = PairingState.NotPaired }; listOfDevices.Add(pairableDevice); //Cast the List Using the OfType Operator List <PairableDevice> listOfPD = listOfDevices.OfType <PairableDevice>().ToList <PairableDevice>(); Assert.AreEqual(pairableDevice, listOfPD[0]); }
void deviceAdded(DeviceManager deviceManager, PairableDevice pairableDevice) { // Finds the matching IADevice from the pairableDevice Identifier IADevice iaDevice = deviceManager.IntAirAct.Devices.Find(d => d.Name.Equals(pairableDevice.Identifier)); if (iaDevice.SupportedRoutes.Contains(Routes.BecomePairedRoute)) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { DeviceControlDictionary[pairableDevice.Identifier] = new DeviceControl(pairableDevice, iaDevice); unpairedDeviceStackPanel.Children.Add(DeviceControlDictionary[pairableDevice.Identifier]); })); } else if (iaDevice.SupportedRoutes.Contains(Routes.GetLocationRoute)) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { DeviceControlDictionary[pairableDevice.Identifier] = new DeviceControl(pairableDevice, iaDevice); surfaceStackPanel.Children.Add(DeviceControlDictionary[pairableDevice.Identifier]); })); } }
public DeviceControl(PairableDevice pairableDevice, IADevice iaDevice) { InitializeComponent(); this.iaDevice = iaDevice; this.pairableDevice = pairableDevice; deviceRotationControl = new DeviceRotationControl(); deviceRotationControl.onSliderValueChanged += new EventHandler <RotationSliderEventArgs>(onOrientationSliderChanged); canvas.Children.Add(deviceRotationControl); Canvas.SetLeft(deviceRotationControl, -170); Canvas.SetTop(deviceRotationControl, -40); //Setup Events pairableDevice.LocationChanged += onLocationChanged; pairableDevice.OrientationChanged += onOrientationChanged; pairableDevice.PairingStateChanged += onPairingStateChanged; LeftLine.StrokeThickness = DrawingResources.DEVICE_FOV_WIDTH; RightLine.StrokeThickness = DrawingResources.DEVICE_FOV_WIDTH; //Setup Display DeviceNameLabel.Text = pairableDevice.Identifier; InnerBorder.BorderBrush = DrawingResources.unpairedBrush; // If it supports this route, then we know it's a surface if (iaDevice.SupportedRoutes.Contains(Routes.GetLocationRoute)) { MyDisplayState = DisplayState.UnlocatedAndOnStackPanel; } // Likewise, if it supports this route, we know it's a pairable device else if (iaDevice.SupportedRoutes.Contains(Routes.BecomePairedRoute)) { MyDisplayState = DisplayState.UnpairedAndOnStackPanel; } formatForStackPanel(); }
protected override void OnDrop(DragEventArgs e) { string DataType = e.Data.GetFormats(true)[0]; //if the object dropped is a tracker if (DataType == "trackerControl") { base.OnDrop(e); Point mouseLocation = e.GetPosition(sharedCanvas); // Grab the data we packed into the DataObject TrackerControl trackerControl = (TrackerControl)e.Data.GetData("trackerControl"); // Hide the Ghost and Text since a Drop has been made MainWindow.GhostBorder.Visibility = System.Windows.Visibility.Hidden; ghostTextBlock.Visibility = System.Windows.Visibility.Hidden; // Return the Opacity of the TrackerControl trackerControl.Opacity = 1; trackerControl.Tracker.Location = DrawingResources.ConvertFromDisplayCoordinatesToMeters(mouseLocation, sharedCanvas); // Check if the TrackerControl is already a child of Shared Canvas Point canvasBounds = new Point(DrawingResources.ConvertFromMetersToPixelsX(DrawingResources.ROOM_WIDTH, sharedCanvas), DrawingResources.ConvertFromMetersToPixelsY(DrawingResources.ROOM_HEIGHT, sharedCanvas)); if (!trackerControl.IsDescendantOf(SharedCanvas)) { trackerControl.formatForCanvas(); kinectWrapPanel.Children.Remove(trackerControl); SharedCanvas.Children.Add(trackerControl); if (trackerControl.Tracker.Orientation == null) { trackerControl.Tracker.Orientation = 270; } } // if the cursor is outside the canvas, put the tracker back in stackpanel. else if (!(mouseLocation.X < canvasBounds.X && mouseLocation.Y < canvasBounds.Y)) { trackerControl.Tracker.StopStreaming(); cleanUpKinectPersons(trackerControl.Tracker.Identifier); trackerControl.formatForStackPanel(); SharedCanvas.Children.Remove(trackerControl); kinectWrapPanel.Children.Add(trackerControl); } } //if the objet dropped is a device. else if (DataType == "deviceControl") { base.OnDrop(e); Point mouseLocation = e.GetPosition(sharedCanvas); // Grab the data we packed into the DataObject DeviceControl deviceControl = (DeviceControl)e.Data.GetData("deviceControl"); // Hide the Ghost and Text since a Drop has been made MainWindow.GhostBorder.Visibility = System.Windows.Visibility.Hidden; ghostTextBlock.Visibility = System.Windows.Visibility.Hidden; // Return the Opacity of the DeviceControl deviceControl.Opacity = 1; PairableDevice device = deviceControl.PairableDevice; IADevice iaDevice = deviceControl.IADevice; IARequest request = new IARequest(Routes.SetLocationRoute); request.Parameters["identifier"] = iaDevice.Name; Point canvasBounds = new Point(DrawingResources.ConvertFromMetersToPixelsX(DrawingResources.ROOM_WIDTH, sharedCanvas), DrawingResources.ConvertFromMetersToPixelsY(DrawingResources.ROOM_HEIGHT, sharedCanvas)); //if the dragged device is a pairable device (i.e iPad) if (!iaDevice.SupportedRoutes.Contains(Routes.GetLocationRoute)) { Point mouseLocationOnCanvas = mouseLocation = DrawingResources.ConvertFromDisplayCoordinatesToMeters(mouseLocation, sharedCanvas); bool pairedToNewDevice = false; foreach (KeyValuePair <PairablePerson, PersonControl> keyPair in PersonControlDictionary) { Point personLocation = keyPair.Key.Location.Value; double distance = Math.Sqrt(Math.Pow(mouseLocationOnCanvas.X - personLocation.X, 2) + Math.Pow(mouseLocationOnCanvas.Y - personLocation.Y, 2)); //if the mouse drop is close to a person, pair the device with that person. if (distance < 0.3 && (device.HeldByPersonIdentifier == keyPair.Key.Identifier || keyPair.Key.PairingState != PairingState.Paired)) { if (device.PairingState == PairingState.Paired || device.PairingState == PairingState.PairedButOccluded) { kinectManager.PairingRecognizer.UnpairDevice(device); } kinectManager.PairingRecognizer.Pair(device, keyPair.Key); pairedToNewDevice = true; break; } } //if the mouse drop is not close to a person then unpair the device. if (!pairedToNewDevice) { kinectManager.PairingRecognizer.UnpairDevice(device); } } //if the dragged device is not a pairable device (i.e table-top) else if (iaDevice.SupportedRoutes.Contains(Routes.GetLocationRoute)) { if (mouseLocation.X < canvasBounds.X && mouseLocation.Y < canvasBounds.Y) { // Dropped within Canvas, so we want to place it on the canvas device.Location = DrawingResources.ConvertFromDisplayCoordinatesToMeters(mouseLocation, sharedCanvas); request.SetBodyWith(new IntermediatePoint(device.Location.Value)); } else { // Not dropped within Canvas, so we want to put it back on the stack panel device.Location = null; request.SetBodyWith(null); } // Send a request to the Device that their location has changed kinectManager.IntAirAct.SendRequest(request, iaDevice); } } }
public void AllDevicesWithinRangeTest() { Setup(); PairableDevice observer = new PairableDevice { Location = new Point(10, 10), Orientation = 0, Identifier = "observer", }; PairableDevice nearest = new PairableDevice { Location = new Point(0, 5), Identifier = "nearest", Orientation = 0, }; PairableDevice furthest = new PairableDevice { Location = new Point(-5, 0), Identifier = "furthest", Orientation = 0, }; PairableDevice tooFar = new PairableDevice { Location = new Point(100, 100), Identifier = "tooFar", Orientation = 50, }; Server.Locator.Devices.Add(observer); Server.Locator.Devices.Add(furthest); Server.Locator.Devices.Add(nearest); Server.Locator.Devices.Add(tooFar); Server.Start(); Client.Start(); WaitForConnections(); IARequest request = new IARequest(Routes.GetAllDevicesInRangeRoute); request.Parameters["identifier"] = observer.Identifier; request.Parameters["range"] = "50.0"; Client.SendRequest(request, Server.IntAirAct.OwnDevice, delegate(IAResponse response, Exception e) { List <IntermediateDevice> intDevices = response.BodyAs <IntermediateDevice>(); IntermediateDevice intDevice = intDevices.Find(x => x.identifier == nearest.Identifier); Assert.AreEqual(nearest.Location, intDevice.location); Assert.AreEqual(nearest.Orientation, intDevice.orientation); intDevice = intDevices.Find(x => x.identifier == furthest.Identifier); Assert.AreEqual(furthest.Location, intDevice.location); Assert.AreEqual(furthest.Orientation, intDevice.orientation); // The 'tooFar' device should not be returned Assert.AreEqual(2, intDevices.Count); doneWaitingForResponse = true; }); WaitForResponse(); Teardown(); }
public void SuccessfulPairingTest() { Setup(); // We would like to be able to test the round trip communication, sending 'request pairing' on the client to the server, to sending // 'become paired' from server to client. // But internally, tinyIOC registers things by type, so only the first instance of intairact's server adapter gets retrieved. // All routes are handled by the same IAA instance, which is obviously a problem when we have two in the system that we would like to have talk to each other. // So, at present this part of the test cannot work //Client.Route(Routes.BecomePairedRoute, delegate(IARequest request, IAResponse response) //{ // doneWaitingForResponse = true; //}); Server.Start(); Client.Start(); WaitForConnections(); // Create a person on the server, who is attempting to pair their device // NB: Setting PairingAttempt on a Person begins a 3 second timer, after which their pairing state resets to NotPaired // The test should always complete before then, but if mysterious failures start appearing, it could be time related Server.Locator.Persons.Add(new PairablePerson() { Identifier = "Bob", Location = new System.Windows.Point(1, 1), PairingState = PairingState.PairingAttempt }); // Notify the server that the client wants to be paired IARequest pairingRequest = new IARequest(Routes.RequestPairingRoute); pairingRequest.Origin = Client.OwnDevice; pairingRequest.Parameters["identifier"] = Client.OwnDevice.Name; Client.SendRequest(pairingRequest, Server.IntAirAct.OwnDevice, delegate(IAResponse response, Exception exception) { if (exception != null) { System.Diagnostics.Debug.WriteLine(exception.Message); Assert.Fail(); } // In response to the return of the request, we test some properties on the server // Find the mock pairable person we created, test their pairing state PairablePerson person = (PairablePerson)Server.Locator.Persons.Find(x => x.Identifier.Equals("Bob")); Assert.AreEqual(PairingState.Paired, person.PairingState); // Find the Client's IADevice on the server, test its pariing state PairableDevice device = (PairableDevice)Server.Locator.Devices.Find(x => x.Identifier.Equals(Client.OwnDevice.Name)); Assert.AreEqual(PairingState.Paired, device.PairingState); // Test that the two were paired with each other Assert.AreEqual(person.HeldDeviceIdentifier, device.Identifier); Assert.AreEqual(device.HeldByPersonIdentifier, person.Identifier); doneWaitingForResponse = true; }); WaitForResponse(); Teardown(); }