public void OneNoExtAttr_ManualMock()
        {
            var hackApi = new TestSdBluesoleilApi();

            byte[]        setSvcName = Encoding.UTF8.GetBytes("aabbccdd");
            var           attrs      = new Structs.BtSdkRemoteServiceAttrStru(0, 0x1112, setSvcName, IntPtr.Zero);
            ServiceRecord sr         = BluesoleilDeviceInfo.CreateServiceRecord(ref attrs, hackApi);
            //
            const string NewLine      = "\r\n";
            const string expectedDump = "AttrId: 0x0001 -- ServiceClassIdList" + NewLine
                                        + "ElementSequence" + NewLine
                                        + "    Uuid16: 0x1112 -- HeadsetAudioGateway" + NewLine
                                        + NewLine
                                        + "AttrId: 0x0006 -- LanguageBaseAttributeIdList" + NewLine
                                        + "ElementSequence" + NewLine
                                        + "    UInt16: 0x656E" + NewLine
                                        + "    UInt16: 0x6A" + NewLine
                                        + "    UInt16: 0x100" + NewLine
                                        + NewLine
                                        + "AttrId: 0x0100 -- ServiceName" + NewLine
                                        + "TextString: [en] 'aabbccdd'" + NewLine
                                        + NewLine
                                        + "AttrId: 0xFFFF" + NewLine
                                        + "TextString (guessing UTF-8): '<partial BlueSoleil decode>'" + NewLine
            ;
            string dump = ServiceRecordUtilities.Dump(sr);

            Assert.AreEqual(expectedDump, dump, "dump");
            //
            ServiceElement e;

            //
            e = sr.GetAttributeById(UniversalAttributeId.ServiceClassIdList).Value;
            ServiceElement eSvcClass = e.GetValueAsElementArray()[0];
            UInt16         svcC      = (UInt16)eSvcClass.Value;

            Assert.AreEqual(0x1112, svcC, "svcC");
            //
            string sn = sr.GetPrimaryMultiLanguageStringAttributeById(UniversalAttributeId.ServiceName);

            Assert.AreEqual("aabbccdd", sn, "sn");
            //----
            hackApi.AssertActionsNoMore();
        }
        public void OneSppExtAttr_ManualMock()
        {
            var hackApi = new TestSdBluesoleilApi();
            //
            const byte Port = 23;
            var        ext  = new Structs.BtSdkRmtSPPSvcExtAttrStru(Port);
            IntPtr     pExt = Marshal.AllocHGlobal(Marshal.SizeOf(ext));

            Marshal.StructureToPtr(ext, pExt, false);
            //
            byte[]        setSvcName = Encoding.UTF8.GetBytes("aabbccdd");
            var           attrs      = new Structs.BtSdkRemoteServiceAttrStru(0, 0x1112, setSvcName, pExt);
            ServiceRecord sr         = BluesoleilDeviceInfo.CreateServiceRecord(ref attrs, hackApi);
            //
            const string NewLine      = "\r\n";
            const string expectedDump = "AttrId: 0x0001 -- ServiceClassIdList" + NewLine
                                        + "ElementSequence" + NewLine
                                        + "    Uuid16: 0x1112 -- HeadsetAudioGateway" + NewLine
                                        + NewLine
                                        + "AttrId: 0x0004 -- ProtocolDescriptorList" + NewLine
                                        + "ElementSequence" + NewLine
                                        + "    ElementSequence" + NewLine
                                        + "        Uuid16: 0x100 -- L2CapProtocol" + NewLine
                                        + "    ElementSequence" + NewLine
                                        + "        Uuid16: 0x3 -- RFCommProtocol" + NewLine
                                        + "        UInt8: 0x17" + NewLine
                                        + "( ( L2Cap ), ( Rfcomm, ChannelNumber=23 ) )" + NewLine
                                        + NewLine
                                        + "AttrId: 0x0006 -- LanguageBaseAttributeIdList" + NewLine
                                        + "ElementSequence" + NewLine
                                        + "    UInt16: 0x656E" + NewLine
                                        + "    UInt16: 0x6A" + NewLine
                                        + "    UInt16: 0x100" + NewLine
                                        + NewLine
                                        + "AttrId: 0x0100 -- ServiceName" + NewLine
                                        + "TextString: [en] 'aabbccdd'" + NewLine
                                        + NewLine
                                        + "AttrId: 0xFFFF" + NewLine
                                        + "TextString (guessing UTF-8): '<partial BlueSoleil decode>'" + NewLine
            ;
            string dump = ServiceRecordUtilities.Dump(sr);

            Assert.AreEqual(expectedDump, dump, "dump");
            //
            ServiceElement e;

            //
            e = sr.GetAttributeById(UniversalAttributeId.ServiceClassIdList).Value;
            ServiceElement eSvcClass = e.GetValueAsElementArray()[0];
            UInt16         svcC      = (UInt16)eSvcClass.Value;

            Assert.AreEqual(0x1112, svcC, "svcC");
            //
            e = sr.GetAttributeById(UniversalAttributeId.ProtocolDescriptorList).Value;
            ServiceElement listRfcomm = e.GetValueAsElementArray()[1];
            ServiceElement eScn       = listRfcomm.GetValueAsElementArray()[1];
            byte           scn        = (byte)eScn.Value;

            Assert.AreEqual(Port, scn, "scn");
            //
            string sn = sr.GetPrimaryMultiLanguageStringAttributeById(UniversalAttributeId.ServiceName);

            Assert.AreEqual("aabbccdd", sn, "sn");
            //----
            hackApi.AssertActionsInOrder("Btsdk_FreeMemory", pExt);
            hackApi.AssertActionsNoMore();
        }