コード例 #1
0
        public void EtpUri_11_Uris()
        {
            var uuid = Uuid();

            ///////////////////////////
            // Invalid URI
            ///////////////////////////

            var uri = new EtpUri("http://www.energistics.org");

            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);

            ///////////////////////////
            // Root URIs
            ///////////////////////////

            uri = new EtpUri("eml:");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);


            uri = new EtpUri("eml://");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsRootUri: true, IsDataspaceUri: true, IsBaseUri: true, IsCanonicalUri: true);

            uri = new EtpUri("eml://?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsRootUri: true, IsDataspaceUri: true, IsBaseUri: true, IsAlternateUri: true, HasQuery: true);

            uri = new EtpUri("eml://#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsRootUri: true, IsDataspaceUri: true, IsBaseUri: true, IsAlternateUri: true, HasHash: true);

            ///////////////////////////
            // Dataspace URIs
            ///////////////////////////

            uri = new EtpUri("eml://data-space/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);

            uri = new EtpUri("eml://data-space/second-level/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);


            uri = new EtpUri("eml://data-space");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsDataspaceUri: true, IsBaseUri: true, IsCanonicalUri: true);

            uri = new EtpUri("eml://data-space?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsDataspaceUri: true, IsBaseUri: true, IsAlternateUri: true, HasQuery: true);

            uri = new EtpUri("eml://data-space#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsDataspaceUri: true, IsBaseUri: true, IsAlternateUri: true, HasHash: true);

            uri = new EtpUri("eml://data-space/second-level");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsDataspaceUri: true, IsBaseUri: true, IsCanonicalUri: true);

            uri = new EtpUri("eml://data-space/second-level?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsDataspaceUri: true, IsBaseUri: true, IsAlternateUri: true, HasQuery: true);

            uri = new EtpUri("eml://data-space/second-level#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsDataspaceUri: true, IsBaseUri: true, IsAlternateUri: true, HasHash: true);

            ///////////////////////////
            // Family Version URIs
            ///////////////////////////

            uri = new EtpUri("eml://witsml20/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);

            uri = new EtpUri("eml://data-space/witsml20/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);

            uri = new EtpUri("eml://data-space/second-level/witsml20/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);


            uri = new EtpUri("eml://witsml20");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsFamilyVersionUri: true, IsBaseUri: true, IsCanonicalUri: true);

            uri = new EtpUri("eml://witsml20?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsFamilyVersionUri: true, IsBaseUri: true, IsAlternateUri: true, HasQuery: true);

            uri = new EtpUri("eml://witsml20#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsFamilyVersionUri: true, IsBaseUri: true, IsAlternateUri: true, HasHash: true);

            uri = new EtpUri("eml://data-space/witsml20");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsFamilyVersionUri: true, IsBaseUri: true, IsCanonicalUri: true);

            uri = new EtpUri("eml://data-space/witsml20?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsFamilyVersionUri: true, IsBaseUri: true, IsAlternateUri: true, HasQuery: true);

            uri = new EtpUri("eml://data-space/witsml20#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsFamilyVersionUri: true, IsBaseUri: true, IsAlternateUri: true, HasHash: true);

            ///////////////////////////
            // Object URIs
            ///////////////////////////

            uri = new EtpUri($"eml://witsml20/Well({uuid})/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);


            uri = new EtpUri($"eml://witsml20/Well({uuid})");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsCanonicalUri: true, IsObjectUri: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsObjectUri: true, HasQuery: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsObjectUri: true, HasHash: true);

            ///////////////////////////
            // Object Hierarchy URIs
            ///////////////////////////

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore({Uuid()})/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore({Uuid()})/Log({Uuid()})/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);


            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore({Uuid()})");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsObjectUri: true, IsHierarchicalUri: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore({Uuid()})?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsObjectUri: true, IsHierarchicalUri: true, HasQuery: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore({Uuid()})#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsObjectUri: true, IsHierarchicalUri: true, HasHash: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore({Uuid()})/Log({Uuid()})");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsObjectUri: true, IsHierarchicalUri: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore({Uuid()})/Log({Uuid()})?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsObjectUri: true, IsHierarchicalUri: true, HasQuery: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore({Uuid()})/Log({Uuid()})#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsObjectUri: true, IsHierarchicalUri: true, HasHash: true);

            ///////////////////////////
            // Folder and Query URIs
            ///////////////////////////

            uri = new EtpUri($"eml://witsml20/Well/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore({Uuid()})/Log/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);


            uri = new EtpUri($"eml://witsml20/Well");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsQueryUri: true, IsFolderUri: true, IsCanonicalUri: true, IsTemplateUri: true, IsFolderTemplateUri: true);

            uri = new EtpUri($"eml://witsml20/Well?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsQueryUri: true, IsFolderUri: true, IsCanonicalUri: true, IsTemplateUri: true, IsFolderTemplateUri: true, HasQuery: true);

            uri = new EtpUri($"eml://witsml20/Well#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsQueryUri: true, IsFolderUri: true, IsAlternateUri: true, IsTemplateUri: true, IsFolderTemplateUri: true, HasHash: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsQueryUri: true, IsFolderUri: true, IsCanonicalUri: true, IsHierarchicalUri: true, IsTemplateUri: true, IsFolderTemplateUri: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsQueryUri: true, IsFolderUri: true, IsCanonicalUri: true, IsHierarchicalUri: true, IsTemplateUri: true, IsFolderTemplateUri: true, HasQuery: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsQueryUri: true, IsFolderUri: true, IsAlternateUri: true, IsHierarchicalUri: true, IsTemplateUri: true, IsFolderTemplateUri: true, HasHash: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore({Uuid()})/Log");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsFolderUri: true, IsAlternateUri: true, IsHierarchicalUri: true, IsTemplateUri: true, IsFolderTemplateUri: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore({Uuid()})/Log?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsFolderUri: true, IsAlternateUri: true, IsHierarchicalUri: true, IsTemplateUri: true, IsFolderTemplateUri: true, HasQuery: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore({Uuid()})/Log#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsFolderUri: true, IsAlternateUri: true, IsHierarchicalUri: true, IsTemplateUri: true, IsFolderTemplateUri: true, HasHash: true);

            ///////////////////////////
            // Template URIs
            ///////////////////////////

            uri = new EtpUri($"eml://witsml20/Well/Wellbore/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore/Log/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore/Log({Uuid()})/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);

            uri = new EtpUri($"eml://witsml20/Well/Wellbore({uuid})/Log/");
            AssertUri(uri, IsValid: false, EtpVersion: EtpVersion.v11);


            uri = new EtpUri($"eml://witsml20/Well/Wellbore");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsTemplateUri: true, IsFolderTemplateUri: true);

            uri = new EtpUri($"eml://witsml20/Well/Wellbore?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsTemplateUri: true, IsFolderTemplateUri: true, HasQuery: true);

            uri = new EtpUri($"eml://witsml20/Well/Wellbore#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsTemplateUri: true, IsFolderTemplateUri: true, HasHash: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore/Log");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsTemplateUri: true, IsFolderTemplateUri: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore/Log?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsTemplateUri: true, IsFolderTemplateUri: true, HasQuery: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore/Log#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsTemplateUri: true, IsFolderTemplateUri: true, HasHash: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore/Log({Uuid()})");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsTemplateUri: true, IsObjectTemplateUri: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore/Log({Uuid()})?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsTemplateUri: true, IsObjectTemplateUri: true, HasQuery: true);

            uri = new EtpUri($"eml://witsml20/Well({uuid})/Wellbore/Log({Uuid()})#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsTemplateUri: true, IsObjectTemplateUri: true, HasHash: true);

            uri = new EtpUri($"eml://witsml20/Well/Wellbore({uuid})/Log");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsTemplateUri: true, IsFolderTemplateUri: true);

            uri = new EtpUri($"eml://witsml20/Well/Wellbore({uuid})/Log?query");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsTemplateUri: true, IsFolderTemplateUri: true, HasQuery: true);

            uri = new EtpUri($"eml://witsml20/Well/Wellbore({uuid})/Log#hash");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsTemplateUri: true, IsFolderTemplateUri: true, HasHash: true);

            ///////////////////////////
            // Special Cases
            ///////////////////////////

            uri = new EtpUri($"eml://witsml14/well()");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsAlternateUri: true, IsObjectUri: true, HasEmptyObjectId: true);

            uri = new EtpUri($"eml://some-data/space/witsml14/well({uuid})/wellbore({Uuid()})");
            AssertUri(uri, IsValid: true, EtpVersion: EtpVersion.v11, IsCanonicalUri: true, IsObjectUri: true, IsHierarchicalUri: true);
        }
コード例 #2
0
        public void EtpUri_11_As_Canonical_Returns_Correct_Uri()
        {
            var uuid  = Uuid();
            var uuid2 = Uuid();

            var original  = new EtpUri("eml://");
            var canonical = new EtpUri("eml://");

            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri("eml://some-data/space");
            canonical = new EtpUri("eml://some-data/space");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri("eml://some-data/space?query#hash");
            canonical = new EtpUri("eml://some-data/space");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri("eml://some-data/space/witsml20");
            canonical = new EtpUri("eml://some-data/space/witsml20");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri("eml://witsml20");
            canonical = new EtpUri("eml://witsml20");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri("eml://witsml20?query#hash");
            canonical = new EtpUri("eml://witsml20");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri("eml://some-data/space/witsml20/Well");
            canonical = new EtpUri("eml://some-data/space/witsml20/Well");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri("eml://some-data/space/witsml20/Well?query");
            canonical = new EtpUri("eml://some-data/space/witsml20/Well?query");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri("eml://some-data/space/witsml20/Well?query#hash");
            canonical = new EtpUri("eml://some-data/space/witsml20/Well?query");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})?query");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})?query#hash");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well/Wellbore");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Wellbore");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well/Wellbore?query");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Wellbore?query");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well/Wellbore?query#hash");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Wellbore?query");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})/Wellbore");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})/Wellbore");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})/Wellbore?query");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})/Wellbore?query");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})/Wellbore?query#hash");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})/Wellbore?query");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})/Wellbore({uuid2})");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Wellbore({uuid2})");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})/Wellbore({uuid2})?query");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Wellbore({uuid2})");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})/Wellbore({uuid2})?query#hash");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Wellbore({uuid2})");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})/Wellbore({uuid2})/Log");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Wellbore({uuid2})/Log");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})/Wellbore({uuid2})/Log?query");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Wellbore({uuid2})/Log?query");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})/Wellbore({uuid2})/Log?query#hash");
            canonical = new EtpUri($"eml://some-data/space/witsml20/Wellbore({uuid2})/Log?query");
            Assert.AreEqual(canonical, original.AsCanonical());

            // Special Cases

            original  = new EtpUri($"eml://some-data/space/witsml20/Well({uuid})/DataAssuranceRecord({uuid2})");
            canonical = new EtpUri($"eml://some-data/space/eml21/DataAssuranceRecord({uuid2})");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml14/well({uuid})/wellbore({uuid2})");
            canonical = new EtpUri($"eml://some-data/space/witsml14/well({uuid})/wellbore({uuid2})");
            Assert.AreEqual(canonical, original.AsCanonical());

            original  = new EtpUri($"eml://some-data/space/witsml14/well()");
            canonical = new EtpUri($"eml://some-data/space/witsml14/well()");
            Assert.AreEqual(canonical, original.AsCanonical());
        }