public void TestDictionaryIntExpression() { Expression<Func<SomeClass, object>> exp = (m) => m.IntDict[101].MyProperty; var propertyName = new PropertyNameResolver().Resolve(exp); var expected = "intDict.101.MID"; Assert.AreEqual(expected, propertyName); }
public void TestCollectionIndexExpressionDoesNotEndUpInPath() { Expression<Func<SomeClass, object>> exp = (m) => m.ListOfCustomClasses[101].MyProperty; var propertyName = new PropertyNameResolver().Resolve(exp); var expected = "listOfCustomClasses.MID"; Assert.AreEqual(expected, propertyName); }
public void TestCreatedDate() { Expression<Func<SomeOtherClass, object>> exp = (m) => m.CreateDate; var propertyName = new PropertyNameResolver().Resolve(exp); var expected = "CreateDate"; Assert.AreEqual(expected, propertyName); }
public void TestUsesElasticProperty() { Expression<Func<SomeClass, object>> exp = (m) => m.MyCustomClass.MyProperty; var propertyName = new PropertyNameResolver().Resolve(exp); var expected = "myCustomClass.MID"; Assert.AreEqual(expected, propertyName); }
public void TestDictionaryStringExpression() { Expression<Func<SomeClass, object>> exp = (m) => m.StringDict["someValue"].CreateDate; var propertyName = new PropertyNameResolver().Resolve(exp); var expected = "stringDict.someValue.CreateDate"; Assert.AreEqual(expected, propertyName); }
public void TestUsesOtherElasticTypePropertyIsIgnored() { Expression<Func<SomeOtherClass, object>> exp = (m) => m.MyCustomOtherClass.MyProperty; var propertyName = new PropertyNameResolver().Resolve(exp); var expected = "myCustomOtherClass.MID"; Assert.AreEqual(expected, propertyName); }
public TypeNameResolver(IConnectionSettings connectionSettings) { connectionSettings.ThrowIfNull("hasDefaultIndices"); this._connectionSettings = connectionSettings; this._propertyNameResolver = new PropertyNameResolver(this._connectionSettings); }
public void TestDictionaryStringDiffValues() { string index = "someValue1"; Expression<Func<SomeClass, object>> exp = (m) => m.StringDict[index].CreateDate; var propertyName = new PropertyNameResolver().Resolve(exp); var expected1 = "stringDict.someValue1.CreateDate"; Assert.AreEqual(expected1, propertyName); index = "someValue2"; exp = (m) => m.StringDict[index].CreateDate; propertyName = new PropertyNameResolver().Resolve(exp); var expected2 = "stringDict.someValue2.CreateDate"; Assert.AreEqual(expected2, propertyName); }
public TypeNameResolver(IConnectionSettingsValues connectionSettings) { connectionSettings.ThrowIfNull("connectionSettings"); this._connectionSettings = connectionSettings; this._propertyNameResolver = new PropertyNameResolver(this._connectionSettings); }