private void TestAddRemove() { int hr = 0; ITuningSpace ts; object id; ts = (ITuningSpace) new DVBTuningSpace(); ts.put_UniqueName("DirectShowLib"); DsError.ThrowExceptionForHR(hr); ts.put_FriendlyName("DirectShowLib TuningSpace test"); DsError.ThrowExceptionForHR(hr); ts.put_NetworkType(typeof(DVBTNetworkProvider).GUID.ToString("B")); DsError.ThrowExceptionForHR(hr); (ts as IDVBTuningSpace2).put_SystemType(DVBSystemType.Terrestrial); DsError.ThrowExceptionForHR(hr); hr = tsContainer.Add(ts, out id); DsError.ThrowExceptionForHR(hr); Debug.Assert(hr == 0, "ITuningSpaceContainer.Add"); hr = tsContainer.Remove(id); DsError.ThrowExceptionForHR(hr); Debug.Assert(hr == 0, "ITuningSpaceContainer.Remove"); Marshal.ReleaseComObject(ts); }