public void TestSetPropertyPathWithPredicate()
        {
            SearchParameter sut = new SearchParameter();

            sut.Base = ResourceType.Slot;
            sut.SetPropertyPath(new string[] { "Slot.extension(url=http://foo.com/myextension).valueReference" });

            Assert.AreEqual("//extension(url=http://foo.com/myextension)/valueReference", sut.Xpath);
        }
        public void TestSetPropertyPathWithMultiplePath()
        {
            SearchParameter sut = new SearchParameter();

            sut.Base = ResourceType.AuditEvent;
            sut.SetPropertyPath(new string[] { "AuditEvent.participant.reference", "AuditEvent.object.reference" });

            Assert.AreEqual("//participant/reference | //object/reference", sut.Xpath);
        }
        public void TestSetPropertyPathWithSinglePath()
        {
            SearchParameter sut = new SearchParameter();

            sut.Base = ResourceType.Appointment;
            sut.SetPropertyPath(new string[] { "Appointment.participant.actor" });

            Assert.AreEqual("//participant/actor", sut.Xpath);
        }
        public void TestSetPropertyPathWithPredicate()
        {
            var sut = new SearchParameter {
                Base = new List <ResourceType?> {
                    ResourceType.Slot
                }
            };

            sut.SetPropertyPath(new[] { "Slot.extension(url=http://foo.com/myextension).valueReference" });

            Assert.Equal("//extension(url=http://foo.com/myextension)/valueReference", sut.Xpath);
        }
        public void TestSetPropertyPathWithMultiplePath()
        {
            var sut = new SearchParameter {
                Base = new List <ResourceType?> {
                    ResourceType.AuditEvent
                }
            };

            sut.SetPropertyPath(new[] { "AuditEvent.participant.reference", "AuditEvent.object.reference" });

            Assert.Equal("//participant/reference | //object/reference", sut.Xpath);
        }
        public void TestSetPropertyPathWithSinglePath()
        {
            var sut = new SearchParameter {
                Base = new List <ResourceType?> {
                    ResourceType.Appointment
                }
            };

            sut.SetPropertyPath(new[] { "Appointment.participant.actor" });

            Assert.Equal("//participant/actor", sut.Xpath);
        }
        private SearchParameter createSearchParameterFromSearchParamDefinition(SearchParamDefinition def)
        {
            var result = new SearchParameter();

            result.Name   = def.Name;
            result.Code   = def.Name; //CK: SearchParamDefinition has no Code, but in all current SearchParameter resources, name and code are equal.
            result.Base   = def.Resource;
            result.Type   = def.Type;
            result.Target = def.Target != null?def.Target.Select(t => GetResourceNameForResourceType(t)) : new List <string>();

            result.Description = def.Description;
            //Strip off the [x], for example in Condition.onset[x].
            result.SetPropertyPath(def.Path?.Select(p => p.Replace("[x]", "")).ToArray());

            //Watch out: SearchParameter is not very good yet with Composite parameters.
            //Therefore we include a reference to the original SearchParamDefinition :-)
            result.SetOriginalDefinition(def);

            return(result);
        }