Esempio n. 1
0
        public void WitsmlValidator_AddToStore_Error_486_Data_Object_Types_Dont_Match()
        {
            var wells = new WellList {
                Well = DevKit.List(Well)
            };

            var xmlIn    = EnergisticsConverter.ObjectToXml(wells);
            var response = DevKit.AddToStore(ObjectTypes.Wellbore, xmlIn, null, null);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.DataObjectTypesDontMatch, response.Result);
        }
Esempio n. 2
0
        public void WitsmlValidator_AddToStore_Error_413_Unsupported_Data_Object()
        {
            // Use an unsupported data schema version
            var wells = new WellList
            {
                Well    = DevKit.List(Well),
                Version = "1.4.x.y"
            };

            var xmlIn    = EnergisticsConverter.ObjectToXml(wells);
            var response = DevKit.AddToStore(ObjectTypes.Well, xmlIn, null, null);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.DataObjectNotSupported, response.Result);
        }
Esempio n. 3
0
        public void WitsmlValidator_UpdateInStore_444_Input_Template_Multiple_DataObjects()
        {
            // Add a well to the store
            AddWell(Well, "WellTest444");

            var wells = new WellList {
                Well = DevKit.List(Well, Well)
            };
            var xmlIn          = EnergisticsConverter.ObjectToXml(wells);
            var updateResponse = DevKit.UpdateInStore(ObjectTypes.Well, xmlIn, null, null);

            // Assert that we have multiple wells
            Assert.IsNotNull(updateResponse);
            Assert.AreEqual((short)ErrorCodes.InputTemplateMultipleDataObjects, updateResponse.Result);
        }
Esempio n. 4
0
        public void WitsmlValidator_AddToStore_Error_468_Missing_Version_Attribute()
        {
            // Use an unsupported data schema version
            var wells = new WellList
            {
                Well    = DevKit.List(Well),
                Version = null
            };

            var xmlIn    = EnergisticsConverter.ObjectToXml(wells);
            var response = DevKit.AddToStore(ObjectTypes.Well, xmlIn, null, null);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.MissingDataSchemaVersion, response.Result);
        }
Esempio n. 5
0
        public void WitsmlValidator_UpdateInStore_Error_468_Missing_Version_Attribute()
        {
            // Add a well and Assert Success
            AddWell(Well, "Well-to-add-missing-version-attribute");

            var wells = new WellList
            {
                Well    = DevKit.List(Well),
                Version = null
            };
            var xmlIn = EnergisticsConverter.ObjectToXml(wells);

            // Update and Assert that the version was missing for update.
            var updateResponse = DevKit.UpdateInStore(ObjectTypes.Well, xmlIn, null, null);

            Assert.IsNotNull(updateResponse);
            Assert.AreEqual((short)ErrorCodes.MissingDataSchemaVersion, updateResponse.Result);
        }
Esempio n. 6
0
        public void WitsmlValidator_AddToStore_Error_444_Mulitple_Data_Objects_Error()
        {
            var well1 = new Well {
                Name = DevKit.Name("Well-to-01"), TimeZone = DevKit.TimeZone, Uid = DevKit.Uid()
            };
            var well2 = new Well {
                Name = DevKit.Name("Well-to-02"), TimeZone = DevKit.TimeZone, Uid = DevKit.Uid()
            };
            var wells = new WellList {
                Well = DevKit.List(well1, well2)
            };

            var xmlIn    = EnergisticsConverter.ObjectToXml(wells);
            var response = DevKit.AddToStore(ObjectTypes.Well, xmlIn, null, null);

            Assert.IsNotNull(response);
            Assert.AreEqual((short)ErrorCodes.InputTemplateMultipleDataObjects, response.Result);
        }
Esempio n. 7
0
        public void FrameworkExtensions_GetPropertyValue_Can_Access_First_List_Element()
        {
            var dataContext = new WellList
            {
                Well = new List <Well>
                {
                    new Well
                    {
                        Uid  = Guid.Empty.ToString(),
                        Name = "Well 01",

                        WellLocation = new List <Location>
                        {
                            new Location
                            {
                                Uid       = "LatLon",
                                Latitude  = new PlaneAngleMeasure(123.456, PlaneAngleUom.dega),
                                Longitude = new PlaneAngleMeasure(987.654, PlaneAngleUom.dega)
                            }
                        }
                    }
                }
            };

            Assert.AreEqual(1, dataContext.GetPropertyValue <int>("Well.Count"));
            Assert.AreEqual(Guid.Empty.ToString(), dataContext.GetPropertyValue <string>("Well.Uid"));
            Assert.AreEqual("Well 01", dataContext.GetPropertyValue <string>("Well.Name"));

            Assert.AreEqual(1, dataContext.GetPropertyValue <int>("Well.WellLocation.Count"));
            Assert.AreEqual(123.456, dataContext.GetPropertyValue <double>("Well.WellLocation.Latitude.Value"));
            Assert.AreEqual(987.654, dataContext.GetPropertyValue <double>("Well.WellLocation.Longitude.Value"));

            Assert.AreEqual(PlaneAngleUom.dega, dataContext.GetPropertyValue <PlaneAngleUom>("Well.WellLocation.Latitude.Uom"));
            Assert.AreEqual(PlaneAngleUom.dega, dataContext.GetPropertyValue <PlaneAngleUom>("Well.WellLocation.Longitude.Uom"));

            // TODO: for future implementation
            //Assert.AreEqual(PlaneAngleUom.dega, dataContext.GetPropertyValue<PlaneAngleUom>("Well.WellLocation[1].Longitude.Uom"));
            //Assert.AreEqual(PlaneAngleUom.dega, dataContext.GetPropertyValue<PlaneAngleUom>("Well.WellLocation[Uid = 'LatLon'].Longitude.Uom"));
        }