public void Well141DataAdapter_DeleteFromStore_Error_420_Specifying_A_Non_Recuring_Attribute_That_Is_Required()
        {
            // Add a minimal test well and Assert its Success
            var wellDatum = new WellDatum()
            {
                Code      = ElevCodeEnum.KB,
                Uid       = "KB",
                Name      = "Kelly Bushing",
                DatumName = new WellKnownNameStruct()
                {
                    Code         = "XX",
                    NamingSystem = "TestName",
                    Value        = "Test"
                }
            };

            Well.WellDatum = new List <WellDatum>
            {
                wellDatum
            };

            DevKit.AddAndAssert(Well);

            // Delete
            var deleteXml = string.Format(BasicXMLTemplate, Well.Uid,
                                          $"<wellDatum uid=\"{wellDatum.Uid}\"><datumName namingSystem=\"\" /></wellDatum>");

            var results = DevKit.DeleteFromStore(ObjectTypes.Well, deleteXml, null, null);

            Assert.IsNotNull(results);
            Assert.AreEqual((short)ErrorCodes.EmptyMandatoryNodeSpecified, results.Result);
        }
        public void Well141DataAdapter_UpdateInStore_Error_409_Missing_Required_Fields_For_Optional_Property()
        {
            // Add well
            var response = DevKit.Add <WellList, Well>(Well);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.Success, response.Result);

            var uid = response.SuppMsgOut;

            var wellDatum = new WellDatum
            {
                Uid  = "DF",
                Code = ElevCodeEnum.DF
            };

            var update = new Well
            {
                Uid       = uid,
                WellDatum = new List <WellDatum> {
                    wellDatum
                }
            };

            var updateResponse = DevKit.Update <WellList, Well>(update);

            Assert.IsNotNull(updateResponse);
            Assert.AreEqual((short)ErrorCodes.UpdateTemplateNonConforming, updateResponse.Result);
        }
Exemplo n.º 3
0
        public void FromWitsmlDatum_ReturnsNullIfListIsNull()
        {
            List <WitsmlDatum> sourceWitsmlDatumList = null;
            var newWellDatum = WellDatum.FromWitsmlWellDatum(sourceWitsmlDatumList);

            Assert.Null(newWellDatum);
        }
Exemplo n.º 4
0
        public void FromWitsmlDatum_ReturnsNullIfListIsEmpty()
        {
            var sourceWitsmlDatumList = new List <WitsmlDatum>();
            var newWellDatum          = WellDatum.FromWitsmlWellDatum(sourceWitsmlDatumList);

            Assert.Null(newWellDatum);
        }
        public void Well141DataAdapter_DeleteFromStore_Error_419_Specifying_A_Non_Recuring_Container_Without_UID()
        {
            // Add a minimal test well and Assert its Success
            DevKit.AddAndAssert(Well);

            // Add wellbore
            var wellbore = new Wellbore()
            {
                UidWell  = Well.Uid,
                Uid      = DevKit.Uid(),
                Name     = DevKit.Name("Wellbore 01"),
                NameWell = Well.Name
            };

            DevKit.AddAndAssert(wellbore);

            // Add rig
            var rig = new Rig()
            {
                UidWell      = Well.Uid,
                UidWellbore  = wellbore.Uid,
                Uid          = DevKit.Uid(),
                Name         = DevKit.Name("Rig 01"),
                NameWellbore = wellbore.Name,
                NameWell     = Well.Name
            };

            DevKit.AddAndAssert(rig);
            var wellDatum = new WellDatum()
            {
                Uid  = "RIG",
                Name = "Rig",
                Rig  = new RefWellWellboreRig()
                {
                    RigReference = new RefNameString()
                    {
                        UidRef = rig.Uid,
                        Value  = rig.Name
                    }
                }
            };

            var returnWell = DevKit.GetAndAssert(Well);

            returnWell.WellDatum = new List <WellDatum>()
            {
                wellDatum
            };
            DevKit.UpdateAndAssert(returnWell);

            // Delete
            var deleteXml = string.Format(BasicXMLTemplate, Well.Uid,
                                          $"<wellDatum uid=\"{wellDatum.Uid}\"><rig /></wellDatum>");

            var results = DevKit.DeleteFromStore(ObjectTypes.Well, deleteXml, null, null);

            Assert.IsNotNull(results);
            Assert.AreEqual((short)ErrorCodes.EmptyNonRecurringElementSpecified, results.Result);
        }
        public void Well141DataAdapter_UpdateInStore_Add_Complex_Element_To_Existing_Recurring_Element()
        {
            // Add a minimal test well and Assert its Success
            Well.WellDatum = new List <WellDatum>
            {
                new WellDatum()
                {
                    Code = ElevCodeEnum.KB,
                    Uid  = "KB",
                    Name = "Kelly Bushing"
                }
            };
            DevKit.AddAndAssert(Well);


            // Create an update well that will update the existing KB datum with a datumName
            var datamWithDatumName = new WellDatum()
            {
                Uid       = "KB",
                DatumName = new WellKnownNameStruct()
                {
                    Code         = "XX",
                    NamingSystem = "TestName",
                    Value        = "Test"
                }
            };

            var updateWell = new Well()
            {
                Uid       = Well.Uid,
                WellDatum = new List <WellDatum>()
                {
                    datamWithDatumName
                }
            };

            // Update well
            var updateResponse = DevKit.Update <WellList, Well>(updateWell);

            Assert.IsNotNull(updateResponse);
            Assert.AreEqual((short)ErrorCodes.Success, updateResponse.Result);

            // Query well to make sure datumName was added
            var result    = DevKit.GetAndAssert(Well);
            var welldatum = result.WellDatum.FirstOrDefault(x => x.Uid.Equals("KB"));

            Assert.IsNotNull(welldatum);
            Assert.AreEqual("Kelly Bushing", welldatum.Name);
            Assert.AreEqual(ElevCodeEnum.KB, welldatum.Code);

            var datumName = welldatum.DatumName;

            Assert.IsNotNull(datumName);
            Assert.AreEqual("TestName", datumName.NamingSystem);
            Assert.AreEqual("XX", datumName.Code);
            Assert.AreEqual("Test", datumName.Value);
        }
Exemplo n.º 7
0
        public void FromWitsmlDatum_ReturnsNullIfWellDatumIsNull()
        {
            WitsmlDatum sourceWitsmlDatum     = null;
            var         sourceWitsmlDatumList = new List <WitsmlDatum> {
                sourceWitsmlDatum
            };
            var newWellDatum = WellDatum.FromWitsmlWellDatum(sourceWitsmlDatumList);

            Assert.Null(newWellDatum);
        }
Exemplo n.º 8
0
        public void FromWitsmlDatum_CopiesCorrectly_WhenListAndDatumExists(string name, string code, string elevation)
        {
            var sourceWitsmlDatum = new WitsmlDatum
            {
                Name      = name,
                Code      = code,
                Elevation = elevation
            };

            var sourceWitsmlDatumList = new List <WitsmlDatum> {
                sourceWitsmlDatum
            };

            var newWellDatum = WellDatum.FromWitsmlWellDatum(sourceWitsmlDatumList);

            Assert.Equal(newWellDatum.Name, sourceWitsmlDatum.Name);
            Assert.Equal(newWellDatum.Code, sourceWitsmlDatum.Code);
            Assert.Equal(newWellDatum.Elevation, sourceWitsmlDatum.Elevation);
        }