示例#1
0
        public async Task WellCompletion200_PutObject_Can_Add_WellCompletion()
        {
            AddParents();
            await RequestSessionAndAssert();

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

            var dataObject = CreateDataObject(uri, WellCompletion);

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

            // Check for message flag indicating No Data
            Assert.IsNotNull(args?.Header);
            Assert.AreEqual((int)MessageFlags.NoData, args.Header.MessageFlags);

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

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

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

            var result = Parse <WellCompletion>(xml);

            Assert.IsNotNull(result);
        }
示例#2
0
        public async Task WellCompletion200_PutObject_Can_Add_WellCompletion()
        {
            AddParents();
            await RequestSessionAndAssert();

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

            var dataObject = CreateDataObject(uri, WellCompletion);

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

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

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

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

            var result = Parse <WellCompletion>(xml);

            Assert.IsNotNull(result);
        }
示例#3
0
        public async Task WellCompletion200_PutObject_Can_Update_WellCompletion()
        {
            AddParents();
            await RequestSessionAndAssert();

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

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

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

            var dataObject = CreateDataObject(uri, WellCompletion);

            // 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 <WellCompletion>(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 <WellCompletion>(updateXml);
            Assert.IsNotNull(result);

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

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

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

            var dataObject = CreateDataObject <WellCompletionList, WellCompletion>(uri, WellCompletion);

            // 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 <WellCompletionList, WellCompletion>(xml);

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

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

            var updateDataObject = CreateDataObject <WellCompletionList, WellCompletion>(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 <WellCompletionList, WellCompletion>(updateXml);
            Assert.IsNotNull(result);

            // Test Data Object overwrite
            Assert.IsNull(result.CommonData.Comments);
        }
示例#5
0
        public async Task WellCompletion200_GetResources_Can_Get_All_WellCompletion_Resources()
        {
            AddParents();
            DevKit.AddAndAssert(WellCompletion);
            await RequestSessionAndAssert();

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

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

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

            await GetResourcesAndAssert(folderUri);
        }