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(); }
//[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); }
// 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); }