public void ZeroHandleReturned() { var listAllocs = new List <IntPtr>(); var stuff = BluetopiaSdpParseTests.Create_BluetopiaSdpQuery(); const int TheirRequestId_InvalidZero = 0; // Expect.Once.On(stuff.MockedApi).Method("SDP_Service_Search_Attribute_Request") //TODO With(...Is.Anything,...)*/ /**/.With(stuff.StackId, Addr2Long, //Is.Anything,//new byte[6], //-- (uint)1, Is.Anything, //new Structs.SDP_UUID_Entry[1], //-- (uint)1, Is.Anything, //new Structs.SDP_Attribute_ID_List_Entry[1], //-- new InTheHand.Net.Bluetooth.StonestreetOne.NativeMethods .SDP_Response_Callback(stuff.DutSdpQuery.HandleSDP_Response_Callback), Is.Anything //OurRequestId ) /**/ .Will(Return.Value(TheirRequestId_InvalidZero)); try { var ar = stuff.DutSdpQuery.BeginQuery(Addr2, SvcClass2, false, null, null); Assert.Fail("should have thrown!"); } catch (SocketException) { } }
public void RealGsrOne() { var listAllocs = new List <IntPtr>(); var stuff = BluetopiaSdpParseTests.Create_BluetopiaSdpQuery(); var dutBdi = (BluetopiaDeviceInfo)stuff.GetFactory().DoGetBluetoothDeviceInfo(Addr2); stuff.SetDut(dutBdi.Testing_GetSdpQuery()); Debug.Assert(stuff.DutSdpQuery != null, "NULL stuff.DutSdpQuery"); //const uint OurRequestId = 0 + 1; const byte Port = 17; const int TheirRequestId = 100; // Expect.Once.On(stuff.MockedApi).Method("SDP_Service_Search_Attribute_Request") //TODO With(...Is.Anything,...)*/ /**/.With(stuff.StackId, Addr2Long, //Is.Anything,//new byte[6], //-- (uint)1, Is.Anything, //new Structs.SDP_UUID_Entry[1], //-- (uint)1, Is.Anything, //new Structs.SDP_Attribute_ID_List_Entry[1], //-- new InTheHand.Net.Bluetooth.StonestreetOne.NativeMethods .SDP_Response_Callback(stuff.DutSdpQuery.HandleSDP_Response_Callback), Is.Anything //OurRequestId ) /**/ .Will(Return.Value(TheirRequestId)); var ar = dutBdi.BeginGetServiceRecords(SvcClass2, null, null); // Assert.IsFalse(ar.IsCompleted, "IsCompleted before event"); ClientTestingBluetopia.RaiseSdpEvent(stuff, BluetopiaSdpParseTests.ProtoDListMake_InSDPResponse_Data(listAllocs, Port), TheirRequestId); // ClientTestingBluetopia.SafeWait(ar); Assert.IsTrue(ar.IsCompleted, "IsCompleted after event"); ServiceRecord[] rList = dutBdi.EndGetServiceRecords(ar); BluetopiaSdpParseTests.Free(listAllocs); // BluetopiaSdpParseTests.ProtoDList_Assert(rList[0][0], Port); }