예제 #1
0
        void DoTest_HackOneSeqDeep(StackConsts.SDP_Data_Element_Type expectedET,
                                   byte[] expectedDataValue,
                                   ServiceElement element)
        {
            var r = new ServiceRecord(new ServiceAttribute(0xF234,
                                                           element));

            //==
            r = BluetopiaTesting.HackAddSvcClassList(r);
            //==
            DoTest_HackOneSeqDeep(expectedET, expectedDataValue, r);
        }
예제 #2
0
        public void CallingTwice()
        {
            // Haven't decided whether to keep the instance to hold one
            // live record or like the base to create multiple records,
            // probably the first.
            //
            var stuff = BluetopiaTesting.InitMockery_SdpCreator();

            try {
                stuff.DutSdpCreator.CreateServiceRecord(BluetopiaTesting.HackAddSvcClassList(new ServiceRecord()));
                stuff.DutSdpCreator.CreateServiceRecord(BluetopiaTesting.HackAddSvcClassList(new ServiceRecord()));
            } finally {
                VerifyDispose(stuff);
            }
        }
예제 #3
0
        // The tests are included in the base class.
        protected override void DoTest(byte[] expectedRecordBytes, ServiceRecord record)
        {
            byte[] buf   = new byte[1024];
            var    stuff = BluetopiaTesting.InitMockery_SdpCreator();

            //
            if (expectedRecordBytes == Data_SdpCreator_SingleElementTests.RecordBytes_Empty)
            {
                Debug.Assert(!resultMap.ContainsKey(expectedRecordBytes), "manually handled!");
            }
            else
            {
                // All other expected results are in the mapping table.
                // Next can throw KeyNotFoundException.
                SdpServiceExpectedCall expected = resultMap[expectedRecordBytes];
                Expect.Once.On(stuff.MockApi2).Method("SDP_Add_Attribute")
                .With(
                    Is.Anything,
                    Is.Anything,
                    expected.attrId,
                    expected.element
                    )
                .Will(Return.Value(BluetopiaError.OK));
            }
            //==
            record = BluetopiaTesting.HackAddSvcClassList(record);
            //==
            stuff.DutSdpCreator.CreateServiceRecord(record);
            stuff.Mockery_VerifyAllExpectationsHaveBeenMet();
            //
            Expect.Once.On(stuff.MockApi2).Method("SDP_Delete_Service_Record")
            .With(
                Is.Anything,
                Is.Anything)
            .Will(Return.Value(BluetopiaError.OK));
            stuff.DutSdpCreator.Dispose();
            stuff.Mockery_VerifyAllExpectationsHaveBeenMet();
        }