Exemplo n.º 1
0
 public void Accept1_AndFinalize()
 {
     {
         var state = Init(new Options
         {
             ServerInsecure         = true,
             Start                  = true,
             Accept                 = true,
             GetStream1             = true,
             Stop                   = true,
             ServerExpectedSvcClass = BluetoothService.ObexFileTransfer,
             ConstructParams        = new object[] { BluetoothService.ObexFileTransfer, },
         });
         var lsnr = state.Lsnr;
         lsnr.Start();
         var cli  = lsnr.AcceptBluetoothClient();
         var peer = cli.GetStream();
         //
         AndroidTesting.AllowClientClose_WillRunOnFinalizer(cli, false);
         cli   = null;
         peer  = null;
         lsnr  = null;
         state = null;
     }
     GC.Collect();
     GC.Collect();
     GC.WaitForPendingFinalizers();
     //
     VerifyAll();
 }
Exemplo n.º 2
0
        public void Accept1_EndPoint()
        {
            var state = Init(new Options
            {
                ServerInsecure         = true,
                Start                  = true,
                Accept                 = true,
                GetStream1             = true,
                Stop                   = true,
                ServerExpectedSvcClass = BluetoothService.SerialPort,
                ConstructParams        = new object[] {
                    new BluetoothEndPoint(BluetoothAddress.None,
                                          BluetoothService.SerialPort),
                },
            });
            var lsnr = state.Lsnr;

            lsnr.Start();
            var cli  = lsnr.AcceptBluetoothClient();
            var peer = cli.GetStream();

            lsnr.Stop();
            //
            VerifyAll();
            AndroidTesting.AllowClientClose_WillRunOnFinalizer(cli);
        }
Exemplo n.º 3
0
        public void NoConnect_Dispose()
        {
            var state = AndroidTesting.Init(new Options
            {
                Insecure        = true,
                GetRemoteDevice = false,
                CreateSocket    = false,
                //Connect = false,
                ClientDispose    = true,
                ExpectedSvcClass = BluetoothService.ObexObjectPush,
            });

            state.Cli.Dispose();
            //
            state.VerifyAll();
        }
Exemplo n.º 4
0
        //[Test]
        //public void Connect_Get_Finalizer()
        //{
        //    var state = Connect_Get_DisposeOptional(AndroidTesting.Disposal.Stream);
        //    var vfy = state.Verifier;
        //    state = null;
        //    GC.Collect();
        //    GC.Collect();
        //    GC.WaitForPendingFinalizers();
        //    vfy.VerifyAll();
        //}

        AndroidTesting.TestState Connect_Get_DisposeOptional(AndroidTesting.Disposal disposal)
        {
            var state = AndroidTesting.Init(new Options
            {
                Insecure        = true,
                GetRemoteDevice = true,
                CreateSocket    = true,
                Connect         = true,
                GetStream1      = true,
                ClientDispose   = false,
                //ExpectedAddress = Addr1,
                ExpectedSvcClass = SvcA,
                //ConstructParams = new object[] { BluetoothService.ObexObjectPush, },
            });
            var cli = state.Cli;

            cli.Connect(new BluetoothEndPoint(Addr1, SvcA));
            var peer = cli.GetStream();

            //
            switch (disposal)
            {
            case AndroidTesting.Disposal.No:
                break;

            case AndroidTesting.Disposal.Client:
                AndroidTesting.AllowClientClose_WillRunOnFinalizer(cli);
                cli.Dispose();
                break;

            case AndroidTesting.Disposal.Stream:
                AndroidTesting.AllowClientClose_WillRunOnFinalizer(cli);
                peer.Close();
                break;

            default:
                break;
            }
            //
            state.VerifyAll();
            if (disposal == AndroidTesting.Disposal.No)
            {
                AndroidTesting.AllowClientClose_WillRunOnFinalizer(cli);
            }
            return(state);
        }
Exemplo n.º 5
0
        // TODO [Test] Connect_ToPort_NoGet_NoDispose
        public void Connect_ToPort_NoGet_NoDispose()
        {
            var state = AndroidTesting.Init(new Options
            {
                Insecure        = true,
                GetRemoteDevice = true,
                CreateSocket    = true,
                Connect         = true,
                GetStream1      = true,
                ClientDispose   = false,
                //ExpectedAddress = Addr1,
                //ExpectedSvcClass = SvcA,
                //ConstructParams = new object[] { BluetoothService.ObexObjectPush, },
            });
            var cli = state.Cli;

            cli.Connect(new BluetoothEndPoint(Addr1, SvcA, PortM));
            var peer = cli.GetStream();

            //
            state.VerifyAll();
            AndroidTesting.AllowClientClose_WillRunOnFinalizer(cli);
        }
Exemplo n.º 6
0
        public void Accept1_NoGet()//copied from above
        {
            var state = Init(new Options
            {
                ServerInsecure         = true,
                Start                  = true,
                Accept                 = true,
                GetStream1             = false,
                Stop                   = true,
                ServerExpectedSvcClass = BluetoothService.ObexFileTransfer,
                ConstructParams        = new object[] { BluetoothService.ObexFileTransfer, },
            });
            var lsnr = state.Lsnr;

            lsnr.Start();
            var cli = lsnr.AcceptBluetoothClient();

            //var peer = cli.GetStream();
            lsnr.Stop();
            //
            VerifyAll();
            AndroidTesting.AllowClientClose_WillRunOnFinalizer(cli);
        }