コード例 #1
0
        public void SsdpDevicePropertiesCollection_Contains_PropertyWithNullNameThrows()
        {
            var properties = new SsdpDevicePropertiesCollection();
            var p          = new SsdpDeviceProperty();

            properties.Contains(p);
        }
コード例 #2
0
        public void SsdpDevicePropertiesCollection_Add_NullFullNameThrows()
        {
            var properties = new SsdpDevicePropertiesCollection();
            var p          = new SsdpDeviceProperty();

            properties.Add(p);
        }
コード例 #3
0
 public void SsdpDevicePropertiesCollection_Add_EmptyFullNameThrows()
 {
     var properties = new SsdpDevicePropertiesCollection();
     var p = new SsdpDeviceProperty()
     {
         Name = String.Empty,
         Namespace = String.Empty
     };
     properties.Add(p);
 }
コード例 #4
0
        public void SsdpDevicePropertiesCollection_Contains_PropertyWithEmptyNameThrows()
        {
            var properties = new SsdpDevicePropertiesCollection();
            var p          = new SsdpDeviceProperty()
            {
                Name      = String.Empty,
                Namespace = String.Empty
            };

            properties.Contains(p);
        }
コード例 #5
0
        public void SsdpDevicePropertiesCollection_Add_EmptyFullNameThrows()
        {
            var properties = new SsdpDevicePropertiesCollection();
            var p          = new SsdpDeviceProperty()
            {
                Name      = String.Empty,
                Namespace = String.Empty
            };

            properties.Add(p);
        }
コード例 #6
0
ファイル: SsdpDevice.cs プロジェクト: noex/RSSDP
        /// <summary>
        /// Derived type constructor, allows constructing a device with no parent. Should only be used from derived types that are or inherit from <see cref="SsdpRootDevice"/>.
        /// </summary>
        protected SsdpDevice()
        {
            _DeviceTypeNamespace = SsdpConstants.UpnpDeviceTypeNamespace;
            _DeviceType = SsdpConstants.UpnpDeviceTypeBasicDevice;
            _DeviceVersion = 1;

            this.Icons = new List<SsdpDeviceIcon>();
            _Devices = new List<SsdpDevice>();
            this.Devices = new ReadOnlyEnumerable<SsdpDevice>(_Devices);

            _CustomProperties = new SsdpDevicePropertiesCollection();
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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"));
        }
コード例 #9
0
        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));
        }
コード例 #10
0
        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]);
        }
コード例 #11
0
        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"]);
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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);
        }
コード例 #14
0
        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());
        }
コード例 #15
0
        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);
        }
コード例 #16
0
        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));
        }
コード例 #17
0
        public void SsdpDevicePropertiesCollection_Contains_ReturnsFalseForNonExistentProperty()
        {
            var properties = new SsdpDevicePropertiesCollection();
            var prop = new SsdpDeviceProperty()
            {
                Name = "TestProperty",
                Namespace = "MyNamespace",
                Value = "1.0"
            };

            var prop2 = new SsdpDeviceProperty()
            {
                Name = "TestProperty1",
                Namespace = "MyNamespace",
                Value = "1.0"
            };

            properties.Add(prop);

            Assert.AreEqual(false, properties.Contains(prop2));
        }
コード例 #18
0
        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);
        }
コード例 #19
0
        public void SsdpDevicePropertiesCollection_Count_ReturnsZeroForNewCollection()
        {
            var properties = new SsdpDevicePropertiesCollection();

            Assert.AreEqual(0, properties.Count);
        }
コード例 #20
0
        public void SsdpDevicePropertiesCollection_Count_ReturnsZeroForNewCollection()
        {
            var properties = new SsdpDevicePropertiesCollection();

            Assert.AreEqual(0, properties.Count);
        }
コード例 #21
0
        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]);
        }
コード例 #22
0
        public void SsdpDevicePropertiesCollection_Remove_EmptyKeyThrows()
        {
            var properties = new SsdpDevicePropertiesCollection();

            properties.Remove(String.Empty);
        }
コード例 #23
0
 public void SsdpDevicePropertiesCollection_Contains_NullPropertyThrows()
 {
     var properties = new SsdpDevicePropertiesCollection();
     properties.Contains((SsdpDeviceProperty)null);
 }
コード例 #24
0
 public void SsdpDevicePropertiesCollection_Contains_PropertyWithEmptyNameThrows()
 {
     var properties = new SsdpDevicePropertiesCollection();
     var p = new SsdpDeviceProperty()
         {
             Name = String.Empty,
             Namespace=  String.Empty
         };
     properties.Contains(p);
 }
コード例 #25
0
 public void SsdpDevicePropertiesCollection_Contains_EmptyNameThrows()
 {
     var properties = new SsdpDevicePropertiesCollection();
     properties.Contains(String.Empty);
 }
コード例 #26
0
 public void SsdpDevicePropertiesCollection_Contains_NullNameThrows()
 {
     var properties = new SsdpDevicePropertiesCollection();
     properties.Contains((string)null);
 }
コード例 #27
0
 public void SsdpDevicePropertiesCollection_CapacityConstructor_SucceedsWithZeroValue()
 {
     var properties = new SsdpDevicePropertiesCollection(0);
 }
コード例 #28
0
 public void SsdpDevicePropertiesCollection_CapacityConstructor_Succeeds()
 {
     var properties = new SsdpDevicePropertiesCollection(10);
 }
コード例 #29
0
 public void SsdpDevicePropertiesCollection_CapacityConstructor_FailsWithNegativeValue()
 {
     var properties = new SsdpDevicePropertiesCollection(-1);
 }
コード例 #30
0
        public void SsdpDevicePropertiesCollection_Remove_NullKeyThrows()
        {
            var properties = new SsdpDevicePropertiesCollection();

            properties.Remove((string)null);
        }
コード例 #31
0
 public void SsdpDevicePropertiesCollection_Contains_PropertyWithNullNameThrows()
 {
     var properties = new SsdpDevicePropertiesCollection();
     var p = new SsdpDeviceProperty();
     properties.Contains(p);
 }
コード例 #32
0
        public void SsdpDevicePropertiesCollection_Add_NullThrows()
        {
            var properties = new SsdpDevicePropertiesCollection();

            properties.Add(null);
        }
コード例 #33
0
        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);
        }
コード例 #34
0
        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"]);
        }
コード例 #35
0
 public void SsdpDevicePropertiesCollection_CapacityConstructor_Succeeds()
 {
     var properties = new SsdpDevicePropertiesCollection(10);
 }
コード例 #36
0
 public void SsdpDevicePropertiesCollection_CapacityConstructor_FailsWithNegativeValue()
 {
     var properties = new SsdpDevicePropertiesCollection(-1);
 }
コード例 #37
0
        public void SsdpDevicePropertiesCollection_Contains_NullNameThrows()
        {
            var properties = new SsdpDevicePropertiesCollection();

            properties.Contains((string)null);
        }
コード例 #38
0
        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());
        }
コード例 #39
0
        public void SsdpDevicePropertiesCollection_Contains_EmptyNameThrows()
        {
            var properties = new SsdpDevicePropertiesCollection();

            properties.Contains(String.Empty);
        }
コード例 #40
0
        public void SsdpDevicePropertiesCollection_Add_NullDeviceThrows()
        {
            var properties = new SsdpDevicePropertiesCollection();

            properties.Add(null);
        }
コード例 #41
0
        public void SsdpDevicePropertiesCollection_Contains_NullPropertyThrows()
        {
            var properties = new SsdpDevicePropertiesCollection();

            properties.Contains((SsdpDeviceProperty)null);
        }
コード例 #42
0
        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);
        }
コード例 #43
0
        public void SsdpDevicePropertiesCollection_Remove_NullThrows()
        {
            var properties = new SsdpDevicePropertiesCollection();

            properties.Remove((SsdpDeviceProperty)null);
        }
コード例 #44
0
        public void SsdpDevicePropertiesCollection_Contains_ReturnsTrueForExistingKey()
        {
            var properties = new SsdpDevicePropertiesCollection();
            var prop = new SsdpDeviceProperty()
            {
                Name = "TestProperty",
                Namespace = "MyNamespace",
                Value = "1.0"
            };

            properties.Add(prop);

            Assert.AreEqual(true, properties.Contains(prop.FullName));
        }
コード例 #45
0
 public void SsdpDevicePropertiesCollection_Remove_NullFullNameThrows()
 {
     var properties = new SsdpDevicePropertiesCollection();
     var p = new SsdpDeviceProperty();
     properties.Remove(p);
 }
コード例 #46
0
        public void SsdpDevicePropertiesCollection_Remove_NullDeviceThrows()
        {
            var properties = new SsdpDevicePropertiesCollection();

            properties.Remove((SsdpDeviceProperty)null);
        }
コード例 #47
0
 public void SsdpDevicePropertiesCollection_CapacityConstructor_SucceedsWithZeroValue()
 {
     var properties = new SsdpDevicePropertiesCollection(0);
 }
コード例 #48
0
        public void SsdpDevicePropertiesCollection_Remove_EmptyKeyThrows()
        {
            var properties = new SsdpDevicePropertiesCollection();

            properties.Remove(String.Empty);
        }
コード例 #49
0
        public void SsdpDevicePropertiesCollection_Remove_RemoveInstanceSucceeds()
        {
            var properties = new SsdpDevicePropertiesCollection();
            var p = new SsdpDeviceProperty()
            {
                Name = "TestProp1",
                Namespace = "TestNamespace"
            };

            properties.Add(p);

            Assert.AreEqual(true, properties.Remove(p));
            Assert.AreEqual(0, properties.Count);
        }