public void SsdpDevicePropertiesCollection_Contains_PropertyWithNullNameThrows() { var properties = new SsdpDevicePropertiesCollection(); var p = new SsdpDeviceProperty(); properties.Contains(p); }
public void SsdpDevicePropertiesCollection_Add_NullFullNameThrows() { var properties = new SsdpDevicePropertiesCollection(); var p = new SsdpDeviceProperty(); properties.Add(p); }
public void DeviceProperty_FullNameIsCorrectWithNoNamespaceSpecified() { var prop = new SsdpDeviceProperty(); prop.Name = "TestPropName"; prop.Value = "TestValue"; Assert.AreEqual("TestPropName", prop.FullName); }
public void DeviceProperty_FullNameIsCorrectFormat() { var prop = new SsdpDeviceProperty(); prop.Namespace = "TestNamespace"; prop.Name = "TestPropName"; prop.Value = "TestValue"; Assert.AreEqual("TestNamespace:TestPropName", prop.FullName); }
public void SsdpDevicePropertiesCollection_Contains_PropertyWithEmptyNameThrows() { var properties = new SsdpDevicePropertiesCollection(); var p = new SsdpDeviceProperty() { Name = String.Empty, Namespace = String.Empty }; properties.Contains(p); }
public void SsdpDevicePropertiesCollection_Add_EmptyFullNameThrows() { var properties = new SsdpDevicePropertiesCollection(); var p = new SsdpDeviceProperty() { Name = String.Empty, Namespace = String.Empty }; properties.Add(p); }
private SsdpRootDevice CreateDeviceTree(SsdpDeviceProperty testHeader = null) { var retVal = CreateValidRootDevice(); if (testHeader != null) { retVal.additionalSearchResponseProperties.Add(testHeader); } retVal.AddDevice(CreateValidEmbeddedDevice(retVal)); retVal.Devices.First().AddDevice(CreateValidEmbeddedDevice(retVal)); return(retVal); }
public void SsdpDevicePropertiesCollection_Count_ReturnsZeroAfterLastItemRemoved() { var properties = new SsdpDevicePropertiesCollection(); var prop = new SsdpDeviceProperty() { Name = "TestProperty", Namespace = "MyNamespace", Value = "1.0" }; properties.Remove(prop); Assert.AreEqual(0, properties.Count); }
public void SsdpDevicePropertiesCollection_Remove_RemoveByKeySucceeds() { var properties = new SsdpDevicePropertiesCollection(); var p = new SsdpDeviceProperty() { Name = "TestProp1", Namespace = "TestNamespace" }; properties.Add(p); Assert.AreEqual(true, properties.Remove(p.FullName)); Assert.AreEqual(0, properties.Count); }
public void SsdpDevicePropertiesCollection_Contains_ReturnsFalseForNonExistentKey() { var properties = new SsdpDevicePropertiesCollection(); var prop = new SsdpDeviceProperty() { Name = "TestProperty", Namespace = "MyNamespace", Value = "1.0" }; properties.Add(prop); Assert.AreEqual(false, properties.Contains("NotAValidKey")); }
public void SsdpDevicePropertiesCollection_Count_ReturnsOneAfterItemAdded() { var properties = new SsdpDevicePropertiesCollection(); var prop = new SsdpDeviceProperty() { Name = "TestProperty", Namespace = "MyNamespace", Value = "1.0" }; properties.Add(prop); Assert.AreEqual(1, properties.Count); }
public void SsdpDevicePropertiesCollection_Indexer_ThrowsOnUnknownKey() { var properties = new SsdpDevicePropertiesCollection(); var p = new SsdpDeviceProperty() { Name = "Test", Namespace = "TestNamespace", Value = "some value" }; properties.Add(p); Assert.AreEqual(p, properties["NotAValidKey"]); }
public void SsdpDevicePropertiesCollection_Indexer_Succeeds() { var properties = new SsdpDevicePropertiesCollection(); var p = new SsdpDeviceProperty() { Name = "Test", Namespace = "TestNamespace", Value = "some value" }; properties.Add(p); Assert.AreEqual(p, properties[p.FullName]); }
public void SsdpDevicePropertiesCollection_Contains_ReturnsTrueForExistingItem() { var properties = new SsdpDevicePropertiesCollection(); var prop = new SsdpDeviceProperty() { Name = "TestProperty", Namespace = "MyNamespace", Value = "1.0" }; properties.Add(prop); Assert.AreEqual(true, properties.Contains(prop)); }
private SsdpRootDevice CreateSampleRootDevice() { var retVal = new SsdpRootDevice() { CacheLifetime = TimeSpan.FromMinutes(30), DeviceType = "TestDeviceType", DeviceTypeNamespace = "test-device-ns", FriendlyName = "Test Device 1", Location = new Uri("http://testdevice:1700"), Manufacturer = "Test Manufacturer", ManufacturerUrl = new Uri("http://testman.com"), ModelDescription = "A test device", ModelName = "Test Model", ModelNumber = "1234", ModelUrl = new Uri("http://testmodel.com"), PresentationUrl = new Uri("http://testmodel.com/presentation"), SerialNumber = "TM-12345", Upc = "123456789012", UrlBase = new Uri("http://testdevice:1700"), Uuid = Guid.NewGuid().ToString() }; var customProp = new SsdpDeviceProperty() { Namespace = "custom-ns", Name = "TestProp1", Value = "Test" }; retVal.CustomProperties.Add(customProp); customProp = new SsdpDeviceProperty() { Namespace = "custom-ns", Name = "TestProp2", Value = "Test" }; retVal.CustomProperties.Add(customProp); var icon = new SsdpDeviceIcon() { ColorDepth = 32, Height = 48, Width = 48, MimeType = "image/png", Url = new Uri("icons/48", UriKind.Relative) }; retVal.Icons.Add(icon); icon = new SsdpDeviceIcon() { ColorDepth = 32, Height = 120, Width = 120, MimeType = "image/png", Url = new Uri("icons/120", UriKind.Relative) }; retVal.Icons.Add(icon); return(retVal); }
public void SsdpDevicePropertiesCollection_GetEnumerator_Success() { var properties = new SsdpDevicePropertiesCollection(); var prop = new SsdpDeviceProperty() { Name = "TestProperty", Namespace = "MyNamespace", Value = "1.0" }; properties.Add(prop); var enumerator = ((IEnumerable)properties).GetEnumerator(); Assert.AreEqual(true, enumerator.MoveNext()); Assert.AreEqual(prop, enumerator.Current); Assert.AreEqual(false, enumerator.MoveNext()); }
public void SsdpDevicePropertiesCollection_Remove_RemoveInstanceForDifferentInstanceWithSameKeyReturnsFalse() { var properties = new SsdpDevicePropertiesCollection(); var p = new SsdpDeviceProperty() { Name = "TestProp1", Namespace = "TestNamespace" }; var p2 = new SsdpDeviceProperty() { Name = "TestProp1", Namespace = "TestNamespace" }; properties.Add(p); Assert.AreEqual(false, properties.Remove(p2)); Assert.AreEqual(1, properties.Count); }
public void SsdpDevicePropertiesCollection_Contains_ReturnsFalseForExistingKeyDifferentItem() { var properties = new SsdpDevicePropertiesCollection(); var prop = new SsdpDeviceProperty() { Name = "TestProperty", Namespace = "MyNamespace", Value = "1.0" }; var prop2 = new SsdpDeviceProperty() { Name = "TestProperty", Namespace = "MyNamespace", Value = "1.0" }; properties.Add(prop); Assert.AreEqual(false, properties.Contains(prop2)); }