Esempio n. 1
0
        /// <inheritdoc/>
        public override bool TryMatch(ODataPathSegment pathSegment, IDictionary <string, object> values)
        {
            if (pathSegment.SegmentKind == ODataSegmentKinds.EntitySet)
            {
                EntitySetPathSegment entitySetSegment = (EntitySetPathSegment)pathSegment;
                return(entitySetSegment.EntitySet == EntitySet && entitySetSegment.EntitySetName == EntitySetName);
            }

            return(false);
        }
Esempio n. 2
0
        public void TryMatch_ReturnsTrue_IfMatchingEntitySet()
        {
            // Arrange
            IEdmEntitySet            entitySet = new Mock <IEdmEntitySet>().Object;
            ODataPathSegmentTemplate template  = new EntitySetPathSegment(entitySet);
            EntitySetPathSegment     segment   = new EntitySetPathSegment(entitySet);

            // Act
            Dictionary <string, object> values = new Dictionary <string, object>();
            bool result = template.TryMatch(segment, values);

            // Assert
            Assert.True(result);
            Assert.Empty(values);
        }
        public void TryMatch_ReturnsTrue_IfMatchingEntitySet()
        {
            // Arrange
            IEdmEntitySet entitySet = new Mock<IEdmEntitySet>().Object;
            ODataPathSegmentTemplate template = new EntitySetPathSegment(entitySet);
            EntitySetPathSegment segment = new EntitySetPathSegment(entitySet);

            // Act
            Dictionary<string, object> values = new Dictionary<string, object>();
            bool result = template.TryMatch(segment, values);

            // Assert
            Assert.True(result);
            Assert.Empty(values);
        }
Esempio n. 4
0
        public void Translate_EntitySetSegment_To_EntitySetPathSegment_Works()
        {
            // Arrange
            IEdmEntitySet    entityset = _model.FindDeclaredEntitySet("RoutingCustomers");
            EntitySetSegment segment   = new EntitySetSegment(entityset);

            // Act
            IEnumerable <ODataPathSegment> segments = _translator.Translate(segment);

            // Assert
            ODataPathSegment     pathSegment          = Assert.Single(segments);
            EntitySetPathSegment entitySetPathSegment = Assert.IsType <EntitySetPathSegment>(pathSegment);

            Assert.Same(entityset, entitySetPathSegment.EntitySetBase);
        }
Esempio n. 5
0
        public void Property_SegmentKind_IsEntitySet()
        {
            EntitySetPathSegment segment = new EntitySetPathSegment(entitySetName: "Customers");

            Assert.Equal(ODataSegmentKinds.EntitySet, segment.SegmentKind);
        }
 public void Property_SegmentKind_IsEntitySet()
 {
     EntitySetPathSegment segment = new EntitySetPathSegment(entitySetName: "Customers");
     Assert.Equal(ODataSegmentKinds.EntitySet, segment.SegmentKind);
 }