示例#1
0
        public void TryMatch_DifferentType()
        {
            // Arrange
            PathTemplateSegment         pathTemplateSegment = new PathTemplateSegment("{pName:dynamicproperty}");
            PathTemplateSegmentTemplate template            = new PathTemplateSegmentTemplate(pathTemplateSegment);

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

            // Assert
            Assert.False(result);
        }
示例#2
0
        public void TryMatch_RetrunsTrue()
        {
            // Arrange
            PathTemplateSegment         pathTemplateSegment = new PathTemplateSegment("{pName:dynamicproperty}");
            PathTemplateSegmentTemplate template            = new PathTemplateSegmentTemplate(pathTemplateSegment);
            DynamicPathSegment          segment             = new DynamicPathSegment("property");

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

            // Assert
            Assert.True(result);
            Assert.True(values.ContainsKey("pName"));
            Assert.Equal("property", values["pName"]);
        }