public void ContainsByIdAndLangNull() { ServiceRecord record = RecordAccess_Data.CreateRecordWithZeroItems(); // Assert.IsFalse(record.Contains(UniversalAttributeId.ServiceRecordHandle, null)); }
public void ContainsByIdAndLangFake() { ServiceRecord record = RecordAccess_Data.CreateRecordWithZeroItems(); // LanguageBaseItem langFake = new LanguageBaseItem(1, 2, 3); Assert.IsFalse(record.Contains(UniversalAttributeId.ServiceRecordHandle, langFake)); }
//---- public new void CreateServiceRecord(ServiceRecord record) { if (record == null) { throw new ArgumentNullException("record"); } if (_hSR.HasValue) { throw new InvalidOperationException("One at a time please."); } // ServiceElement svcIdListElement; var newList = new List <ServiceAttribute>(Math.Max(record.Count - 1, 0)); foreach (var cur in record) { if (cur.Id == UniversalAttributeId.ServiceClassIdList) { svcIdListElement = cur.Value; } else { newList.Add(cur); } } var newRecord = new ServiceRecord(newList); Debug.Assert(!newRecord.Contains(UniversalAttributeId.ServiceClassIdList), "DOES!! contain SvcIdList"); // Add the list of UUIDs var el = record.GetAttributeById(UniversalAttributeId.ServiceClassIdList).Value; var classList = el.GetValueAsElementList(); var svcIdListList = new Structs.SDP_UUID_Entry_Bytes[classList.Count]; for (int i = 0; i < svcIdListList.Length; ++i) { svcIdListList[i] = Structs.SDP_UUID_Entry_Bytes.Create(classList[i]); } Debug.Assert(svcIdListList.Length != 0, "Docs: 'the number of UUID Entries'...'CANNOT be zero'."); // int hSR = _fcty.Api.SDP_Create_Service_Record(_fcty.StackId, checked ((uint)svcIdListList.Length), svcIdListList); var ret = (BluetopiaError)hSR; BluetopiaUtils.CheckAndThrowZeroIsIllegal(ret, "SDP_Create_Service_Record"); _hSR = unchecked ((uint)hSR); // int count = base.CreateServiceRecord(newRecord, s_dummy); }
public static void RecordWithZeroItems_AssertIs(ServiceRecord record) { ServiceAttribute attr; Assert.AreEqual(0, record.Count); // IList_ServiceAttributeId ids = record.AttributeIds; Assert.AreEqual(0, ids.Count); // Assert.IsFalse(record.Contains(UniversalAttributeId.ServiceRecordHandle)); // //TODO ((((test disabled for TryGetAttributeById))) //bool found = record.TryGetAttributeById(UniversalAttributeId.ServiceRecordHandle, out attr); //Assert.IsFalse(found); try { attr = record.GetAttributeById(UniversalAttributeId.ServiceRecordHandle); Assert.Fail("Record should contain no attribute."); } catch (KeyNotFoundException) { } }