Esempio n. 1
0
        public void Ctor_SetPropertiesCorrectly()
        {
            // Arrange
            PathTemplateSegment segment = new PathTemplateSegment("{pName:dynamicproperty}");

            // Act
            PathTemplateSegmentTemplate template = new PathTemplateSegmentTemplate(segment);

            // Assert
            Assert.Equal("pName", template.PropertyName);
            Assert.Equal("dynamicproperty", template.SegmentName);
        }
Esempio n. 2
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);
        }
Esempio n. 3
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"]);
        }