public void GetDevicesInFront() { Locator locator = new Locator(); Device iPad = GenerateDeviceWithDimensions("iPad", new Point(0, 0), 45, 0.5, 0.5); Device table = GenerateDeviceWithDimensions("TableTop", new Point(4, 4), 90, 2, 2); locator.Devices.Add(iPad); locator.Devices.Add(table); Point p = new Point(1, 0); List<Device> devices = locator.GetDevicesInView(iPad); Assert.AreEqual(devices.Count, 0); //Assert.AreEqual(dic[table].X, p.X, 0.01); //Assert.AreEqual(dic[table].Y, p.Y, 0.01); }
public void GetDevicesInViewTest() { //Create Locator with Devices which should intersect Locator locator = new Locator(); Device observing = GenerateDevice("DeviceOne", new Point(10, 10), 90); Device observed = GenerateDevice("DeviceTwo", new Point(10, 20), 270); Device notObserved = GenerateDevice("DeviceThree", new Point(20, 20), 180); locator.Devices.Add(observing); locator.Devices.Add(observed); locator.Devices.Add(notObserved); //Compute intersecting devices for the observing device List<Device> actualIntersectingDevices = locator.GetDevicesInView(observing); //Confirm that observed is contained in the list of observed devices Assert.IsTrue(actualIntersectingDevices.Exists(d => d.Identifier == observed.Identifier), "Observed is Missing"); //Confirm that notObserved is NOT contained in the list of observed devices Assert.IsFalse(actualIntersectingDevices.Exists(d => d.Identifier == notObserved.Identifier), "Not Observed is Present"); }
public void GetDevicesInViewWithIntersectionPoints_upperRightCorner() { Locator locator = new Locator(); Device iPad = GenerateDeviceWithDimensions("iPad", new Point(4, 4), 225, 0.5, 0.5); Device table = GenerateDeviceWithDimensions("TableTop", new Point(2, 2), null, 2, 2); locator.Devices.Add(iPad); locator.Devices.Add(table); Point p = new Point(1, 0); List<Device> devices = locator.GetDevicesInView(iPad); Assert.AreEqual(devices.Find(x => x.Identifier.Equals("table")).intersectionPoint["x"], p.X, 0.01); Assert.AreEqual(devices.Find(x => x.Identifier.Equals("table")).intersectionPoint["y"], p.Y, 0.01); }
public void GetDevicesInViewWithIntersectionPoints_upperLeftCorner() { //Create Locator with Devices which should intersect Locator locator = new Locator(); Device iPad = GenerateDeviceWithDimensions("iPad", new Point(0, 6), 315, 0.5, 0.5); Device table = GenerateDeviceWithDimensions("TableTop", new Point(6, 2), null, 2, 6); locator.Devices.Add(iPad); locator.Devices.Add(table); Point p = new Point(0, 0); List<Device> devices = locator.GetDevicesInView(iPad); Assert.AreEqual(devices.Find(x => x.Identifier.Equals("table")).intersectionPoint["x"], p.X, 0.01); Assert.AreEqual(devices.Find(x => x.Identifier.Equals("table")).intersectionPoint["y"], p.Y, 0.01); }
public void GetDevicesInViewWithIntersectionPoints_nullHeightAndWidth() { //Create Locator with Devices which should intersect Locator locator = new Locator(); Device iPad = GenerateDeviceWithDimensions("iPad", new Point(0, 0), 45, 1, 1); Device table = GenerateDeviceWithDimensions("TableTop", new Point(3, 3), 45, null, null); locator.Devices.Add(iPad); locator.Devices.Add(table); List<Device> devices = locator.GetDevicesInView(iPad); Assert.IsTrue(devices.Count == 0); }
public void GetDevicesInViewWithIntersectionPoints_normalInput() { //Create Locator with Devices which should intersect Locator locator = new Locator(); Device iPad = GenerateDeviceWithDimensions("iPad", new Point(3, 0), 70, 1, 1); Device table = GenerateDeviceWithDimensions("TableTop", new Point(4, 3), null, 1, 5); locator.Devices.Add(iPad); locator.Devices.Add(table); Point p = new Point(0.48,1); List<Device> devices = locator.GetDevicesInView(iPad); Assert.AreEqual(devices.Find(x => x.Identifier.Equals("table")).intersectionPoint["x"], p.X, 0.01); Assert.AreEqual(devices.Find(x => x.Identifier.Equals("table")).intersectionPoint["y"], p.Y, 0.01); }
public void GetDevicesInViewWithIntersectionPoints_55DegreesFromLowerLeft() { Locator locator = new Locator(); Device iPad = GenerateDeviceWithDimensions("iPad", new Point(1, 0), 55, 0.5, 0.5); Device table = GenerateDeviceWithDimensions("TableTop", new Point(2, 2), null, 2.5, 2); locator.Devices.Add(iPad); locator.Devices.Add(table); Point p = new Point(0.26, 1); List<Device> devices = locator.GetDevicesInView(iPad); Assert.AreEqual(devices.Find(x => x.Identifier.Equals("table")).intersectionPoint["x"], p.X, 0.01); Assert.AreEqual(devices.Find(x => x.Identifier.Equals("table")).intersectionPoint["y"], p.Y, 0.01); }