public void GetProperties_ThrowsNotSupportedException()
        {
            IBusinessObjectPropertyPath path = DynamicBusinessObjectPropertyPath.Create("TypeTwoValue.TypeThreeValue.TypeFourValue.IntValue");

            Assert.That(
                () => path.Properties,
                Throws.TypeOf <NotSupportedException>().With.Message.EqualTo("Properties collection cannot be retrieved for dynamic property paths."));
        }
        public void GetResult_InvalidPropertyPath_PropertyNotFound_ReturnsNullPath()
        {
            var root = TypeOne.Create();
            var path = DynamicBusinessObjectPropertyPath.Create("TypeTwoValue.TypeThreeValue.TypeFourValue1.IntValue");

            var result = path.GetResult(
                (IBusinessObject)root,
                BusinessObjectPropertyPath.UnreachableValueBehavior.FailForUnreachableValue,
                BusinessObjectPropertyPath.ListValueBehavior.FailForListProperties);


            Assert.That(result, Is.InstanceOf <NullBusinessObjectPropertyPathResult>());
        }
        public void GetResult_ValidPropertyPath_EndsWithReferenceProperty()
        {
            var root = TypeOne.Create();
            var path = DynamicBusinessObjectPropertyPath.Create("TypeTwoValue.TypeThreeValue.TypeFourValue");

            var result = path.GetResult(
                (IBusinessObject)root,
                BusinessObjectPropertyPath.UnreachableValueBehavior.FailForUnreachableValue,
                BusinessObjectPropertyPath.ListValueBehavior.FailForListProperties);


            Assert.That(result, Is.InstanceOf <EvaluatedBusinessObjectPropertyPathResult>());
            Assert.That(result.ResultObject, Is.SameAs(root.TypeTwoValue.TypeThreeValue));
            Assert.That(result.ResultProperty.Identifier, Is.EqualTo("TypeFourValue"));
        }
        public void GetResult_ValidPropertyPath_EndsWithInt()
        {
            var root = TypeOne.Create();
            IBusinessObjectPropertyPath path = DynamicBusinessObjectPropertyPath.Create("TypeTwoValue.TypeThreeValue.TypeFourValue.IntValue");

            var result = path.GetResult(
                (IBusinessObject)root,
                BusinessObjectPropertyPath.UnreachableValueBehavior.FailForUnreachableValue,
                BusinessObjectPropertyPath.ListValueBehavior.FailForListProperties);


            Assert.That(result, Is.InstanceOf <EvaluatedBusinessObjectPropertyPathResult>());
            Assert.That(result.ResultObject, Is.SameAs(root.TypeTwoValue.TypeThreeValue.TypeFourValue));
            Assert.That(
                result.ResultProperty,
                Is.SameAs(((IBusinessObject)root.TypeTwoValue.TypeThreeValue.TypeFourValue).BusinessObjectClass.GetPropertyDefinition("IntValue")));
        }
 public static IBusinessObjectPropertyPath CreateDynamic(string propertyPathIdentifier)
 {
     return(DynamicBusinessObjectPropertyPath.Create(propertyPathIdentifier));
 }
        public void GetIsDynamic_ReturnsTrue()
        {
            IBusinessObjectPropertyPath path = DynamicBusinessObjectPropertyPath.Create("TypeTwoValue.TypeThreeValue.TypeFourValue.IntValue");

            Assert.That(path.IsDynamic, Is.True);
        }
        public void GetIdentifier_ReturnsIdentifier()
        {
            IBusinessObjectPropertyPath path = DynamicBusinessObjectPropertyPath.Create("TypeTwoValue.TypeThreeValue.TypeFourValue.IntValue");

            Assert.That(path.Identifier, Is.EqualTo("TypeTwoValue.TypeThreeValue.TypeFourValue.IntValue"));
        }