public void Test_03_ClaimUriEmptyValues() { string Uri = "iotdisco:SN=98734238472634;MAN=www.example.org;MODEL=Device;#V=1.0;KEY=;R="; Assert.IsTrue(ThingRegistryClient.IsIoTDiscoClaimURI(Uri)); Assert.IsFalse(ThingRegistryClient.IsIoTDiscoSearchURI(Uri)); MetaDataTag[] Tags = ThingRegistryClient.DecodeIoTDiscoClaimURI(Uri); Assert.AreEqual(6, Tags.Length); Assert.AreEqual("SN", Tags[0].Name); Assert.AreEqual("98734238472634", ((MetaDataStringTag)Tags[0]).Value); Assert.AreEqual("MAN", Tags[1].Name); Assert.AreEqual("www.example.org", ((MetaDataStringTag)Tags[1]).Value); Assert.AreEqual("MODEL", Tags[2].Name); Assert.AreEqual("Device", ((MetaDataStringTag)Tags[2]).Value); Assert.AreEqual("V", Tags[3].Name); Assert.AreEqual(1.0, ((MetaDataNumericTag)Tags[3]).Value); Assert.AreEqual("KEY", Tags[4].Name); Assert.AreEqual(string.Empty, ((MetaDataStringTag)Tags[4]).Value); Assert.AreEqual("R", Tags[5].Name); Assert.AreEqual(string.Empty, ((MetaDataStringTag)Tags[5]).Value); }
public void Test_02_ClaimUriEscape() { string Uri = "iotdisco:SN=98734238472634;MAN=www.example.org;MODEL=Device;#V=1.0;KEY=3453485763440213840928;R=\\discovery\\.example\\;.org"; Assert.IsTrue(ThingRegistryClient.IsIoTDiscoClaimURI(Uri)); Assert.IsFalse(ThingRegistryClient.IsIoTDiscoSearchURI(Uri)); MetaDataTag[] Tags = ThingRegistryClient.DecodeIoTDiscoClaimURI(Uri); Assert.AreEqual(6, Tags.Length); Assert.AreEqual("SN", Tags[0].Name); Assert.AreEqual("98734238472634", ((MetaDataStringTag)Tags[0]).Value); Assert.AreEqual("MAN", Tags[1].Name); Assert.AreEqual("www.example.org", ((MetaDataStringTag)Tags[1]).Value); Assert.AreEqual("MODEL", Tags[2].Name); Assert.AreEqual("Device", ((MetaDataStringTag)Tags[2]).Value); Assert.AreEqual("V", Tags[3].Name); Assert.AreEqual(1.0, ((MetaDataNumericTag)Tags[3]).Value); Assert.AreEqual("KEY", Tags[4].Name); Assert.AreEqual("3453485763440213840928", ((MetaDataStringTag)Tags[4]).Value); Assert.AreEqual("R", Tags[5].Name); Assert.AreEqual("discovery.example;.org", ((MetaDataStringTag)Tags[5]).Value); }
public void Test_09_SearchUri_3_ReverseRangeOrder() { string Uri = "iotdisco:A=1;B>1;C<1;D>=1;E<=1;F<>1;G<2;G>1;H<2;H>=1;I<=2;I>1;J<=2;J>=1;K<2;K>3;L<2;L>=3;M<=2;M>3;N<=2;N>=3;O~+1+2"; Assert.IsFalse(ThingRegistryClient.IsIoTDiscoClaimURI(Uri)); Assert.IsTrue(ThingRegistryClient.IsIoTDiscoSearchURI(Uri)); IEnumerable <SearchOperator> Operators = ThingRegistryClient.DecodeIoTDiscoURI(Uri); this.Test_SearchUri_3(Operators); }
public void Test_07_SearchUri_2_ReverseRangeOrder() { string Uri = "iotdisco:#A=1;#B>1;#C<1;#D>=1;#E<=1;#F<>1;#G<2;#G>1;#H<2;#H>=1;#I<=2;#I>1;#J<=2;#J>=1;#K<2;#K>3;#L<2;#L>=3;#M<=2;#M>3;#N<=2;#N>=3"; Assert.IsFalse(ThingRegistryClient.IsIoTDiscoClaimURI(Uri)); Assert.IsTrue(ThingRegistryClient.IsIoTDiscoSearchURI(Uri)); IEnumerable <SearchOperator> Operators = ThingRegistryClient.DecodeIoTDiscoURI(Uri); this.Test_SearchUri_2(Operators); }
public void Test_05_SearchUri_1_ReverseRangeOrder() { string Uri = "iotdisco:MAN=www.example.org;MODEL=Device;SN~*9873*;#V<2;#V>=1.0;#LON<=-70;#LON>=-72;#LAT<=-33;#LAT>=-34"; Assert.IsFalse(ThingRegistryClient.IsIoTDiscoClaimURI(Uri)); Assert.IsTrue(ThingRegistryClient.IsIoTDiscoSearchURI(Uri)); IEnumerable <SearchOperator> Operators = ThingRegistryClient.DecodeIoTDiscoURI(Uri); this.Test_SearchUri_1(Operators); }
public bool IsIoTDiscoClaimURI(string DiscoUri) { return(ThingRegistryClient.IsIoTDiscoClaimURI(DiscoUri)); }