Ejemplo n.º 1
0
        public void MongoDbUtility_GetDocumentId_Returns_Id_In_BsonDocument_Format()
        {
            AddParents();
            var bsonDoc = MongoDbUtility.GetDocumentId(Well);

            Assert.IsNotNull(bsonDoc);
            Assert.IsTrue(bsonDoc.Elements.Where(f => f.Name.EqualsIgnoreCase(ObjectTypes.Uid)).ToList().Count > 0);
            Assert.AreEqual(Well.Uid, bsonDoc.Elements.Where(f => f.Name.EqualsIgnoreCase(ObjectTypes.Uid)).ToList()[0].Value);

            var bsonDocWellbore = MongoDbUtility.GetDocumentId(Wellbore);

            Assert.IsNotNull(bsonDocWellbore);
            Assert.IsTrue(bsonDocWellbore.Elements.Where(f => f.Name.EqualsIgnoreCase(ObjectTypes.Uid)).ToList().Count > 0);
            Assert.AreEqual(Wellbore.Uid, bsonDocWellbore.Elements.Where(f => f.Name.EqualsIgnoreCase(ObjectTypes.Uid)).ToList()[0].Value);

            var bsonDocLog = MongoDbUtility.GetDocumentId(Log);

            Assert.IsNotNull(bsonDocLog);
            Assert.IsTrue(bsonDocLog.Elements.Where(f => f.Name.EqualsIgnoreCase(ObjectTypes.Uid)).ToList().Count > 0);
            Assert.AreEqual(Log.Uid, bsonDocLog.Elements.Where(f => f.Name.EqualsIgnoreCase(ObjectTypes.Uid)).ToList()[0].Value);

            var well200 = new Witsml200.Well {
                Uuid = DevKit.Uid(), Citation = new Witsml200.ComponentSchemas.Citation {
                    Title = DevKit.Name("Well 01")
                }, TimeZone = DevKit.TimeZone
            };
            var bsonDoc200 = MongoDbUtility.GetDocumentId(well200);

            Assert.IsTrue(bsonDoc200.Elements.Where(f => f.Name.EqualsIgnoreCase(ObjectTypes.Uuid)).ToList().Count > 0);
            Assert.AreEqual(well200.Uuid, bsonDoc200.Elements.Where(f => f.Name.EqualsIgnoreCase(ObjectTypes.Uuid)).ToList()[0].Value);
        }
Ejemplo n.º 2
0
        public void EtpUris_GetUri_Can_Get_200_Uri_Family_From_Type()
        {
            var well = new Witsml200.Well {
                Uuid = _data.Uid()
            };
            var uriFamily = EtpUris.GetUriFamily(well.GetType());

            Assert.IsTrue("eml://witsml20".EqualsIgnoreCase(uriFamily.ToString()));
            Assert.AreEqual("witsml", uriFamily.Family);
            Assert.AreEqual("2.0", uriFamily.Version);
        }
Ejemplo n.º 3
0
        public void EtpUris_GetUri_Can_Get_Well_200_Uri()
        {
            var well = new Witsml200.Well {
                Uuid = _data.Uid()
            };
            var uri = well.GetUri();

            Assert.IsTrue($"eml://witsml20/Well({ well.Uuid })".EqualsIgnoreCase(uri.ToString()));
            Assert.AreEqual("Well", uri.ObjectType);
            Assert.AreEqual(well.Uuid, uri.ObjectId);
        }