Example #1
0
        private static void DoTest(ClientTesting.Behaviour behaviour)
        {
            var stuff = ClientTesting.CreateClient(behaviour);
            //
            var cli = stuff.DutClient;

            cli.SetPin(Pin1234);
            stuff.Mockery.VerifyAllExpectationsHaveBeenMet();
            //
            Expect.Once.On(stuff.MockedSecurityApi)
            .Method("SetPin")
            .With(ClientTesting.Addr1, Pin1234)
            .Will(Return.Value(true));
            ClientTesting.ExpectOpen(stuff);
            ClientTesting.DoOpen(stuff, new Action(delegate {
                Expect.Once.On(stuff.MockedSecurityApi)
                .Method("RevokePin")
                .With(ClientTesting.Addr1)
                .Will(Return.Value(true));
            }));
            stuff.Mockery.VerifyAllExpectationsHaveBeenMet();
            //
            if (behaviour.EndConnectSuccess)
            {
                ClientTesting.RaiseRemoteClose(stuff);
            }
            else
            {
                Expect.Once.On(stuff.MockedApi).Method("SPP_Close_Port")
                .With(stuff.StackId, stuff.DutConn.Testing_GetPortId())
                .Will(Return.Value(BluetopiaError.OK));
            }
            stuff.DutClient.Dispose();
            stuff.Mockery.VerifyAllExpectationsHaveBeenMet();
        }
Example #2
0
        public void SetPin_Async_Port_SuccessConnect()
        {
            var behaviour = new ClientTesting.Behaviour
            {
                ToPortNumber       = true,
                EndConnectSuccess  = true,
                SocketError        = null,
                ConnConfStatusCode = StackConsts.SPP_OPEN_PORT_STATUS.Success,
                MockIBtSecurity    = true,
            };

            DoTest(behaviour);
        }
Example #3
0
        public void SetPin_Async_Port_ConnectFailRfcomm()
        {
            var behaviour = new ClientTesting.Behaviour
            {
                ToPortNumber       = true,
                EndConnectSuccess  = false,
                SocketError        = 10061,
                ConnConfStatusCode = StackConsts.SPP_OPEN_PORT_STATUS.ConnectionRefused,
                MockIBtSecurity    = true,
            };

            DoTest(behaviour);
        }
Example #4
0
        public void SetPin_Async_Service_SuccessConnect()
        {
            var behaviour = new ClientTesting.Behaviour
            {
                ToPortNumber       = false,
                EndConnectSuccess  = true,
                SocketError        = null,
                ConnConfStatusCode = StackConsts.SPP_OPEN_PORT_STATUS.Success,
                SdpMethodResult    = 543,
                SdpQueryResultPort = 5,
                MockIBtSecurity    = true,
            };

            DoTest(behaviour);
        }