示例#1
0
        public string GetHeaderNameByExpression <TDto>(Expression <Func <TDto, object> > expression)
            where TDto : class
        {
            string propertyName = TypePropertiesNameResolver.GetMemberName(expression);
            var    propertyInfo = typeof(TDto).GetProperties().FirstOrDefault(x => x.Name.Equals(propertyName));

            return(GetHeaderNameByProperty(propertyInfo));
        }
示例#2
0
        public MetricPreciseValidationBuilder AssertMetric(Expression <Func <Root, object> > expression)
        {
            string metricName = TypePropertiesNameResolver.GetMemberName(expression);
            Func <Root, object> compiledExpression = expression.Compile();
            dynamic             actualValue        = compiledExpression(PerformanceReport.Value);

            return(new MetricPreciseValidationBuilder(actualValue, metricName));
        }
示例#3
0
        public static string GetUrl <TUrlSettings>(Expression <Func <TUrlSettings, object> > expression, string partialUrl = "")
            where TUrlSettings : class, new()
        {
            string propertyName = TypePropertiesNameResolver.GetMemberName(expression);
            var    urlSettings  = ConfigurationService.GetSection <TUrlSettings>();
            var    propertyInfo = typeof(TUrlSettings).GetProperties().FirstOrDefault(x => x.Name.Equals(propertyName));

            return(new Uri(new Uri(propertyInfo.GetValue(urlSettings) as string), partialUrl).AbsoluteUri);
        }