Esempio n. 1
0
        public void ConstructHoldFingersTest(int[] selectedFingers, string expectedFingers)
        {
            WirelessCommand command  = new WirelessCommand("hand.dev");
            string          expected = String.Format("http://hand.dev/move?fingers={0}&hold=true", expectedFingers);

            string actual = command.MoveFingers(selectedFingers, true);

            Assert.Equal(expected, actual);
        }
Esempio n. 2
0
        public void ConstructStatusCheckTest()
        {
            WirelessCommand command  = new WirelessCommand("hand.dev");
            string          expected = "http://hand.dev/";

            string actual = command.StatusCheck();

            Assert.Equal(expected, actual);
        }
Esempio n. 3
0
        public void ReceiveSuccessfulStatusCheck()
        {
            StartStatusMockServer();

            WirelessCommand             command = new WirelessCommand("localhost:" + mockServer.Ports[0]);
            Dictionary <string, string> actual  = new Dictionary <string, string>();
            string expected = "success";

            actual = command.Request(command.StatusCheck()).GetAwaiter().GetResult();

            Assert.Equal(expected, actual["status"]);

            StopMockServer();
        }
Esempio n. 4
0
        public void ReceiveSuccessfulFingersTest(int[] selectedFingers, bool hold)
        {
            string expectedFingers = String.Join(",", selectedFingers.Select(p => p.ToString()).ToArray());
            string expectedHold    = hold.ToString();

            StartMovementMockServer(expectedFingers, hold);

            WirelessCommand command       = new WirelessCommand("localhost:" + mockServer.Ports[0]);
            string          actualFingers = command.Request(command.MoveFingers(selectedFingers, hold)).GetAwaiter().GetResult()["fingers"];
            string          actualHold    = command.Request(command.MoveFingers(selectedFingers, hold)).GetAwaiter().GetResult()["hold"];

            Assert.Equal(expectedFingers, actualFingers);
            Assert.Equal(expectedHold, actualHold);

            StopMockServer();
        }