public void QueryDefinitionGet() { var qDef = new ETQueryDefinition { AuthStub = client, CustomerKey = queryDefKey, ObjectID = queryDef.ObjectID, Props = new[] { "Name", "ObjectID", "Description" }, SearchFilter = new SimpleFilterPart { Property = "ObjectID", Value = new[] { queryDef.ObjectID.ToString() }, SimpleOperator = SimpleOperators.equals } }; var qdefResponse = qDef.Get(); Assert.AreEqual(qdefResponse.Code, 200); Assert.AreEqual(qdefResponse.Status, true); var def = (ETQueryDefinition)qdefResponse.Results[0]; Assert.AreEqual(def.Name, queryDefKey); Assert.AreEqual(def.Description, desc); }
public void QueryDefinitionUpdate() { var qDef = new ETQueryDefinition { AuthStub = client, CustomerKey = queryDefKey, ObjectID = queryDef.ObjectID, Description = updatedDesc, DataExtensionTarget = new InteractionBaseObject { CustomerKey = targetDEKey, Name = "Store102DEx" }, QueryText = string.Format("SELECT * FROM [{0}] WHERE STOREID=102", dataExtensionName), TargetType = "DE", TargetUpdateType = "Overwrite" }; var qdefResponse = qDef.Patch(); Assert.AreEqual(qdefResponse.Code, 200); Assert.AreEqual(qdefResponse.Status, true); Assert.AreEqual(qdefResponse.Results[0].StatusMessage, "QueryDefinition updated"); qDef = new ETQueryDefinition { AuthStub = client, CustomerKey = queryDefKey, ObjectID = queryDef.ObjectID, Props = new[] { "Name", "ObjectID", "Description" }, SearchFilter = new SimpleFilterPart { Property = "ObjectID", Value = new[] { queryDef.ObjectID.ToString() }, SimpleOperator = SimpleOperators.equals } }; var getResponse = qDef.Get(); Assert.AreEqual(getResponse.Code, 200); Assert.AreEqual(getResponse.Status, true); var def = (ETQueryDefinition)getResponse.Results[0]; Assert.AreEqual(def.Name, queryDefKey); Assert.AreEqual(def.Description, updatedDesc); }