Example #1
0
        public void TryMatch_ConditionalWhenPropertyName(bool isSamePropertyName, string propertName)
        {
            // Arrange
            DynamicPropertyPathSegmentTemplate template = new DynamicPropertyPathSegmentTemplate(new DynamicPropertyPathSegment("matchingproperty"));
            DynamicPropertyPathSegment         segment  = new DynamicPropertyPathSegment(propertName);

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

            // Assert
            Assert.Equal(isSamePropertyName, result);
            Assert.False(values.ContainsKey("matchingproperty"));
        }
        public void TryMatch_ConditionalWhenPropertyName(bool isSamePropertyName, string propertName)
        {
            // Arrange
            DynamicPropertyPathSegmentTemplate template = new DynamicPropertyPathSegmentTemplate(new DynamicPropertyPathSegment("matchingproperty"));
            DynamicPropertyPathSegment segment = new DynamicPropertyPathSegment(propertName);

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

            // Assert
            Assert.Equal(isSamePropertyName, result);
            Assert.False(values.ContainsKey("matchingproperty"));

        }
        public void TryMatch_AlwaysTrueWhenParameterName()
        {
            // Arrange
            DynamicPropertyPathSegmentTemplate template = new DynamicPropertyPathSegmentTemplate(new DynamicPropertyPathSegment("{parameter}"));
            DynamicPropertyPathSegment segment = new DynamicPropertyPathSegment("property");

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

            // Assert
            Assert.True(result);
            Assert.True(values.ContainsKey("parameter"));
            Assert.Equal("property", values["parameter"]);
        }
Example #4
0
        public void TryMatch_AlwaysTrueWhenParameterName()
        {
            // Arrange
            DynamicPropertyPathSegmentTemplate template = new DynamicPropertyPathSegmentTemplate(new DynamicPropertyPathSegment("{parameter}"));
            DynamicPropertyPathSegment         segment  = new DynamicPropertyPathSegment("property");

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

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