public async Task DownholeComponent200_PutObject_Can_Update_DownholeComponent()
        {
            AddParents();
            await RequestSessionAndAssert();

            var handler = _client.Handler <IStoreCustomer>();
            var uri     = DownholeComponent.GetUri();

            // Add a ExtensionNameValue to Data Object
            var envName = "TestPutObject";
            var env     = DevKit.ExtensionNameValue(envName, envName);

            DownholeComponent.ExtensionNameValue = new List <ExtensionNameValue>()
            {
                env
            };

            var dataObject = CreateDataObject(uri, DownholeComponent);

            // Get Object Expecting it Not to Exist
            await GetAndAssert(handler, uri, Energistics.Etp.EtpErrorCodes.NotFound);

            // Put Object for Add
            await PutAndAssert(handler, dataObject);

            // Get Added Object
            var args = await GetAndAssert(handler, uri);

            // Check Added Data Object XML
            Assert.IsNotNull(args?.Message.DataObject);
            var xml = args.Message.DataObject.GetString();

            var result = Parse <DownholeComponent>(xml);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.ExtensionNameValue.FirstOrDefault(e => e.Name.Equals(envName)));

            // Remove Comment from Data Object
            result.ExtensionNameValue.Clear();

            var updateDataObject = CreateDataObject(uri, result);

            // Put Object for Update
            await PutAndAssert(handler, updateDataObject);

            // Get Updated Object
            args = await GetAndAssert(handler, uri);

            // Check Added Data Object XML
            Assert.IsNotNull(args?.Message.DataObject);
            var updateXml = args.Message.DataObject.GetString();

            result = Parse <DownholeComponent>(updateXml);
            Assert.IsNotNull(result);

            // Test Data Object overwrite
            Assert.IsNull(result.ExtensionNameValue.FirstOrDefault(e => e.Name.Equals(envName)));
        }
        public async Task DownholeComponent141_PutObject_Can_Update_DownholeComponent()
        {
            AddParents();
            await RequestSessionAndAssert();

            var handler = _client.Handler <IStoreCustomer>();
            var uri     = DownholeComponent.GetUri();

            // Add a Comment to Data Object
            DownholeComponent.CommonData = new CommonData()
            {
                Comments = "Test PutObject"
            };

            var dataObject = CreateDataObject <DownholeComponentList, DownholeComponent>(uri, DownholeComponent);

            // Get Object Expecting it Not to Exist
            await GetAndAssert(handler, uri, Energistics.Etp.EtpErrorCodes.NotFound);

            // Put Object for Add
            await PutAndAssert(handler, dataObject);

            // Get Added Object
            var args = await GetAndAssert(handler, uri);

            // Check Added Data Object XML
            Assert.IsNotNull(args?.Message.DataObject);
            var xml = args.Message.DataObject.GetString();

            var result = Parse <DownholeComponentList, DownholeComponent>(xml);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.CommonData.Comments);

            // Remove Comment from Data Object
            result.CommonData.Comments = null;

            var updateDataObject = CreateDataObject <DownholeComponentList, DownholeComponent>(uri, result);

            // Put Object for Update
            await PutAndAssert(handler, updateDataObject);

            // Get Updated Object
            args = await GetAndAssert(handler, uri);

            // Check Added Data Object XML
            Assert.IsNotNull(args?.Message.DataObject);
            var updateXml = args.Message.DataObject.GetString();

            result = Parse <DownholeComponentList, DownholeComponent>(updateXml);
            Assert.IsNotNull(result);

            // Test Data Object overwrite
            Assert.IsNull(result.CommonData.Comments);
        }
        public async Task DownholeComponent200_GetResources_Can_Get_All_DownholeComponent_Resources()
        {
            AddParents();
            DevKit.AddAndAssert(DownholeComponent);
            await RequestSessionAndAssert();

            var uri       = DownholeComponent.GetUri();
            var parentUri = uri.Parent;

            await GetResourcesAndAssert(DownholeComponent.Well.GetUri());

            var folderUri = parentUri.Append(uri.ObjectType);

            await GetResourcesAndAssert(folderUri);
        }
 protected override void PrepareData()
 {
     Well = new Well
     {
         Uuid     = DevKit.Uid(),
         Citation = DevKit.Citation("Well"),
         GeographicLocationWGS84 = DevKit.Location(),
         SchemaVersion           = "2.0",
         TimeZone = DevKit.TimeZone
     };
     DownholeComponent = new DownholeComponent
     {
         Uuid          = DevKit.Uid(),
         Citation      = DevKit.Citation("DownholeComponent"),
         Well          = DevKit.DataObjectReference(Well),
         SchemaVersion = EtpUris.GetUriFamily(typeof(DownholeComponent)).Version,
     };
 }
        protected override void PrepareData()
        {
            DevKit.Store.CapServerProviders = DevKit.Store.CapServerProviders
                                              .Where(x => x.DataSchemaVersion == OptionsIn.DataVersion.Version141.Value)
                                              .ToArray();

            Well = new Well
            {
                Uid      = DevKit.Uid(),
                Name     = DevKit.Name("Well"),
                TimeZone = DevKit.TimeZone
            };
            DownholeComponent = new DownholeComponent
            {
                Uid      = DevKit.Uid(),
                Name     = DevKit.Name("DownholeComponent"),
                UidWell  = Well.Uid,
                NameWell = Well.Name,
            };

            QueryEmptyList = DevKit.List(new DownholeComponent());
        }