コード例 #1
0
 void AppendPropertyPath(string name)
 {
     if (PropertyPathBuilder.Length > 0)
     {
         PropertyPathBuilder.Append(".");
     }
     PropertyPathBuilder.Append(name);
 }
コード例 #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);
        }
コード例 #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);
 }
コード例 #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();
        }
コード例 #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);
        }
コード例 #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);
 }
コード例 #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);
        }
コード例 #8
0
 private void Current_path(string currentPath)
 {
     startsWith      = currentPath;
     propPathBuilder = new PropertyPathBuilder <Device>(new MockPropValuesProvider());
 }
コード例 #9
0
        public void BuildPath_ForRootMember_PathContainsNoRootButNestedNameAndMember()
        {
            var path = PropertyPathBuilder.BuildPath(null, "Temp");

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