Example #1
0
 void AppendPropertyPath(string name)
 {
     if (PropertyPathBuilder.Length > 0)
     {
         PropertyPathBuilder.Append(".");
     }
     PropertyPathBuilder.Append(name);
 }
Example #2
0
        public void BuildPath_ForNestedMember_PathContainsNoRootButNestedNameAndMember()
        {
            var property = new Mock <IStructureProperty>();

            property.Setup(s => s.Path).Returns("Nested");

            var path = PropertyPathBuilder.BuildPath(property.Object, "Temp");

            Assert.AreEqual("Nested.Temp", path);
        }
Example #3
0
 protected override Expression VisitMethodCall(MethodCallExpression m)
 {
     base.VisitMethodCall(m);
     if (m.Method.Name == "get_Item" && m.Arguments.Count == 1 && m.Arguments[0].NodeType == ExpressionType.Constant)
     {
         object argumentValue = ((ConstantExpression)m.Arguments[0]).Value;
         PropertyPathBuilder.Append(":").Append(argumentValue.ConvertToString());
     }
     return(m);
 }
Example #4
0
        private void Initialize(EntityContainer entityContainer)
        {
            this.EntityContainer = entityContainer;

            this.entityDataSets       = new Dictionary <EntitySet, EntitySetData>();
            this.associationDataSets  = new Dictionary <AssociationSet, AssociationSetData>();
            this.propertyPathResolver = new PropertyPathBuilder(this);

            this.InitializePropertyPaths();
        }
Example #5
0
        public void BuildPath_ForRootMember_PathContainsOnlyName()
        {
            var property = new Mock <IStructureProperty>();

            property.Setup(s => s.IsRootMember).Returns(true);
            property.Setup(s => s.Name).Returns("TheName");

            var path = PropertyPathBuilder.BuildPath(property.Object);

            Assert.AreEqual("TheName", path);
        }
Example #6
0
 public PropertyPath BuildPropertyPath(Expression expression)
 {
     Visit(expression);
     if (RootType != null || PropertyPathBuilder.Length != 0)
     {
         return(new PropertyPath
         {
             TypePrefix = RootType,
             TypeSuffix = PropertyPathBuilder.ToString()
         });
     }
     return(null);
 }
Example #7
0
        public void BuildPath_ForNestedMember_PathContainsRootAndDelimitorAndNameOfNested()
        {
            var rootProperty = new Mock <IStructureProperty>();

            rootProperty.Setup(s => s.IsRootMember).Returns(true);
            rootProperty.Setup(s => s.Name).Returns("TheRootMember");

            var nestedProperty = new Mock <IStructureProperty>();

            nestedProperty.Setup(s => s.IsRootMember).Returns(false);
            nestedProperty.Setup(s => s.Parent).Returns(rootProperty.Object);
            nestedProperty.Setup(s => s.Name).Returns("TheNestedProperty");

            var path = PropertyPathBuilder.BuildPath(nestedProperty.Object);

            Assert.AreEqual("TheRootMember.TheNestedProperty", path);
        }
 private void Current_path(string currentPath)
 {
     startsWith      = currentPath;
     propPathBuilder = new PropertyPathBuilder <Device>(new MockPropValuesProvider());
 }
Example #9
0
        public void BuildPath_ForRootMember_PathContainsNoRootButNestedNameAndMember()
        {
            var path = PropertyPathBuilder.BuildPath(null, "Temp");

            Assert.AreEqual("Temp", path);
        }