public void Test__GetGenericArgs()
        {
            // Arrange
            var args = InfoViaLinq <Person> .New().FuncLambda <int, double, string, string>(x => x.DoSomething).GetGenericArgs();

            // Act, Assert
            Assert.Empty(args);
        }
        public void Test__GetMethodInfoViaLinq()
        {
            // Arrange
            const string expected = "ToString";

            // Act
            var name = InfoViaLinq <string> .New().FuncLambda <string>(x => x.ToString).GetMethodName();

            // Assert
            Assert.Equal(expected, name);
        }
        public void Test__GetMethodInfoViaLinq_MultiParameters()
        {
            // Arrange
            const string expected = "DoSomething";

            // Act
            var name = InfoViaLinq <Person> .New().FuncLambda <int, double, string, string>(x => x.DoSomething).GetMethodName();

            // Assert
            Assert.Equal(expected, name);
        }
Example #4
0
        private static PropertyInfo ResolveMemberExpression <T, TProperty>(Expression <Func <T, TProperty> > expression)
        {
            var members = InfoViaLinq <T> .New().PropLambda(expression).Members().ToList();

            const string errorMessage = "Nested Properties are not supported";

            Guard.Argument(members)
            .MinCount(1, (_, i) => errorMessage)
            .MaxCount(1, (_, i) => errorMessage);

            return(members.Last());
        }
        public GetFuncInfoExtensionTest()
        {
            _utility = InfoViaLinq <Person> .New();

            _fixture = new Fixture();
        }
 public GetPropertyInfoViaLinqTests()
 {
     _utility = InfoViaLinq <Person> .New();
 }
Example #7
0
 public static IEnumerable <KeyValuePair <PropertyInfo, PropertyInfo> > GetComplex <T>() where T : IModel
 {
     return(InfoViaLinq <T> .New().PropLambda(x => x.Ref.Ref.Name).MappedMembers());
 }
Example #8
0
 public GetAttributeViaLinqTests()
 {
     _utility = InfoViaLinq <Person> .New();
 }