public void String() { // Explicit strings are not cached since they are returned directly by the resolver var resolver = new TestableFieldResolver(new ElasticsearchClientSettings()); resolver.Resolve(Field("name")); resolver.CachedFields.Should().Be(0); }
public void String() { // Explicit strings are not cached since they are returned directly by the resolver var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve(Property("name")); resolver.CachedProperties.Should().Be(0); }
public void SamePropertyTypesOnDifferentTypes() { var resolver = new TestableFieldResolver(new ElasticsearchClientSettings()); resolver.Resolve(Field <FirstTestFieldDocument>(c => c.Project.Name)); resolver.CachedFields.Should().Be(1); resolver.Resolve(Field <SecondTestFieldDocument>(c => c.Project.Name)); resolver.CachedFields.Should().Be(2); }
public void EquivalentPropertiesOnDifferentTypes() { var resolver = new TestableFieldResolver(new ElasticsearchClientSettings()); resolver.Resolve((Field)typeof(Person).GetProperty(nameof(Person.Id))); resolver.CachedFields.Should().Be(1); resolver.Resolve((Field)typeof(CommitActivity).GetProperty(nameof(CommitActivity.Id))); resolver.CachedFields.Should().Be(2); }
public void PropertyInfo() { var resolver = new TestableFieldResolver(new ElasticsearchClientSettings()); resolver.Resolve((Field)typeof(Project).GetProperty(nameof(Project.Name))); resolver.CachedFields.Should().Be(1); resolver.Resolve((Field)typeof(Project).GetProperty(nameof(Project.Name))); resolver.CachedFields.Should().Be(1); }
public void EquivalentExpressionsOnDifferentTypes() { var resolver = new TestableFieldResolver(new ElasticsearchClientSettings()); resolver.Resolve(Field <CommitActivity>(c => c.Id)); resolver.CachedFields.Should().Be(1); resolver.Resolve(Field <Person>(p => p.Id)); resolver.CachedFields.Should().Be(2); }
public void SamePropertyTypesWithDifferentNames() { var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve(Property <TestFieldDocument>(c => c.ProjectA)); resolver.CachedProperties.Should().Be(1); resolver.Resolve(Property <TestFieldDocument>(c => c.ProjectB)); resolver.CachedProperties.Should().Be(2); }
public void SamePropertyTypesWithDifferentNames() { var resolver = new TestableFieldResolver(new ElasticsearchClientSettings()); resolver.Resolve(Field <TestFieldDocument>(c => c.ProjectA)); resolver.CachedFields.Should().Be(1); resolver.Resolve(Field <TestFieldDocument>(c => c.ProjectB)); resolver.CachedFields.Should().Be(2); }
public void ExpressionWithDifferentParameter() { var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve(Property <Project>(p => p.Name)); resolver.CachedProperties.Should().Be(1); resolver.Resolve(Property <Project>(d => d.Name)); resolver.CachedProperties.Should().Be(1); }
public void Expression() { var resolver = new TestableFieldResolver(new ElasticsearchClientSettings()); resolver.Resolve(Property <Project>(p => p.Name)); resolver.CachedProperties.Should().Be(1); resolver.Resolve(Property <Project>(p => p.Name)); resolver.CachedProperties.Should().Be(1); }
public void PropertyInfo() { var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve((PropertyName)typeof(Project).GetProperty(nameof(Project.Name))); resolver.CachedProperties.Should().Be(1); resolver.Resolve((PropertyName)typeof(Project).GetProperty(nameof(Project.Name))); resolver.CachedProperties.Should().Be(1); }
public void EquivalentExpressionsOnDifferentTypes() { var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve(Property <CommitActivity>(c => c.Id)); resolver.CachedProperties.Should().Be(1); resolver.Resolve(Property <Person>(c => c.Id)); resolver.CachedProperties.Should().Be(2); }
public void EquivalentPropertiesOnDifferentTypes() { var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve((PropertyName)typeof(Person).GetProperty(nameof(Person.Id))); resolver.CachedProperties.Should().Be(1); resolver.Resolve((PropertyName)typeof(CommitActivity).GetProperty(nameof(CommitActivity.Id))); resolver.CachedProperties.Should().Be(2); }
public void SamePropertyTypesOnDifferentTypes() { var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve(Property <FirstTestFieldDocument>(c => c.Project.Name)); resolver.CachedProperties.Should().Be(1); resolver.Resolve(Property <SecondTestFieldDocument>(c => c.Project.Name)); resolver.CachedProperties.Should().Be(2); }
public void ExpressionWithDictionaryItemConstantExpressionAndConstantSuffix() { var resolver = new TestableFieldResolver(new ConnectionSettings()); var resolved = resolver.Resolve(Field <Project>(p => p.Metadata["key1"].Suffix("x"))); resolver.CachedFields.Should().Be(1); resolved.Should().Be("metadata.key1.x"); resolved = resolver.Resolve(Field <Project>(p => p.Metadata["key2"].Suffix("y"))); resolver.CachedFields.Should().Be(2); resolved.Should().Be("metadata.key2.y"); }
public void ExpressionWithDictionaryItemConstantExpression() { var resolver = new TestableFieldResolver(new ConnectionSettings()); var resolved = resolver.Resolve(Field <Project>(p => p.Metadata["key1"])); resolver.CachedFields.Should().Be(1); resolved.Should().Contain("key1"); resolved = resolver.Resolve(Field <Project>(p => p.Metadata["key2"])); resolver.CachedFields.Should().Be(2); resolved.Should().Contain("key2"); }
public void ExpressionWithDictionaryItemConstantExpression() { var resolver = new TestableFieldResolver(new ElasticsearchClientSettings()); var resolved = resolver.Resolve(Field <Project>(p => p.Metadata["key1"])); resolver.CachedFields.Should().Be(1); resolved.Should().Be("metadata.key1"); resolved = resolver.Resolve(Field <Project>(p => p.Metadata["key2"])); resolver.CachedFields.Should().Be(2); resolved.Should().Be("metadata.key2"); }
public void ExpressionWithConstantSuffix() { var resolver = new TestableFieldResolver(new ConnectionSettings()); var resolved = resolver.Resolve(Field <Project>(p => p.Name.Suffix("raw"))); resolver.CachedFields.Should().Be(1); resolved.Should().EndWith("raw"); resolved = resolver.Resolve(Field <Project>(p => p.Name.Suffix("foo"))); resolver.CachedFields.Should().Be(2); resolved.Should().EndWith("foo"); }
public void Expression() { var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve(Field <Project>(p => p.Name)); resolver.CachedFields.Should().Be(1); resolver.Resolve(Field <Project>(p => p.Name)); resolver.CachedFields.Should().Be(1); // Boost values should have no bearing on cached field names resolver.Resolve(Field <Project>(p => p.Name, 1.1)); resolver.CachedFields.Should().Be(1); }
public void ExpressionWithDifferentParameters() { var resolver = new TestableFieldResolver(new ElasticsearchClientSettings()); resolver.Resolve(Field <Project>(p => p.Name)); resolver.CachedFields.Should().Be(1); resolver.Resolve(Field <Project>(d => d.Name)); resolver.CachedFields.Should().Be(1); // Boost values should have no bearing on cached field names resolver.Resolve(Field <Project>(e => e.Name, 1.1)); resolver.CachedFields.Should().Be(1); }
public void ExpressionWithDictionaryItemVariableExpression() { var resolver = new TestableFieldResolver(new ConnectionSettings()); var key = "key1"; var resolved = resolver.Resolve(Field <Project>(p => p.Metadata[key])); resolver.CachedFields.Should().Be(0); resolved.Should().Contain(key); key = "key2"; resolved = resolver.Resolve(Field <Project>(p => p.Metadata[key])); resolver.CachedFields.Should().Be(0); resolved.Should().Contain(key); }
public void ExpressionWithDictionaryItemConstantExpressionAndVariableSuffix() { var resolver = new TestableFieldResolver(new ConnectionSettings()); var suffix = "x"; var resolved = resolver.Resolve(Field <Project>(p => p.Metadata["key1"].Suffix(suffix))); resolver.CachedFields.Should().Be(0); resolved.Should().Contain("key1").And.EndWith(".x"); suffix = "y"; resolved = resolver.Resolve(Field <Project>(p => p.Metadata["key2"].Suffix(suffix))); resolver.CachedFields.Should().Be(0); resolved.Should().Contain("key2").And.EndWith(".y"); }
public void ExpressionWithVariableSuffix() { var suffix = "raw"; var resolver = new TestableFieldResolver(new ConnectionSettings()); var resolved = resolver.Resolve(Field <Project>(p => p.Name.Suffix(suffix))); resolved.Should().Be("name.raw"); resolver.CachedFields.Should().Be(0); suffix = "foo"; resolved = resolver.Resolve(Field <Project>(p => p.Name.Suffix(suffix))); resolved.Should().Be("name.foo"); resolver.CachedFields.Should().Be(0); }
public void ExpressionWithDictionaryItemConstantExpressionAndVariableSuffix() { var resolver = new TestableFieldResolver(new ElasticsearchClientSettings()); var suffix = "x"; var resolved = resolver.Resolve(Field <Project>(p => p.Metadata["key1"].Suffix(suffix))); resolver.CachedFields.Should().Be(0); resolved.Should().Be("metadata.key1.x"); suffix = "y"; resolved = resolver.Resolve(Field <Project>(p => p.Metadata["key2"].Suffix(suffix))); resolver.CachedFields.Should().Be(0); resolved.Should().Be("metadata.key2.y"); }
public void ExpressionWithSuffix() { var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve(Field <Project>(p => p.Name)); resolver.CachedFields.Should().Be(1); resolver.Resolve(Field <Project>(p => p.Name)); resolver.CachedFields.Should().Be(1); resolver.Resolve(Field <Project>(p => p.Name.Suffix("raw"))); resolver.CachedFields.Should().Be(2); resolver.Resolve(Field <Project>(p => p.Name.Suffix("raw"), 1.1)); resolver.CachedFields.Should().Be(2); }
public void ExpressionWithDictionaryItemVariableExpressionAndEquivalentConstantSuffix() { var resolver = new TestableFieldResolver(new ConnectionSettings()); var key = "key1"; var resolved = resolver.Resolve(Field <Project>(p => p.Metadata[key].Suffix("x"))); resolver.CachedFields.Should().Be(0); resolved.Should().Be($"metadata.{key}.x"); key = "key2"; resolved = resolver.Resolve(Field <Project>(p => p.Metadata[key].Suffix("x"))); resolver.CachedFields.Should().Be(0); resolved.Should().Be($"metadata.{key}.x"); }
public void ExpressionWithDictionarySuffix() { var resolver = new TestableFieldResolver(new ConnectionSettings()); var key = "key1"; var d = new Dictionary <string, string> { { "key1", "raw" }, { "key2", "foo" } }; var resolved = resolver.Resolve(Field <Project>(p => p.Name.Suffix(d[key]))); resolved.Should().EndWith("raw"); resolver.CachedFields.Should().Be(0); resolver.Resolve(Field <Project>(p => p.Name.Suffix(d["key1"]))); resolver.CachedFields.Should().Be(0); key = "key2"; resolved = resolver.Resolve(Field <Project>(p => p.Name.Suffix(d[key]))); resolved.Should().EndWith("foo"); resolver.CachedFields.Should().Be(0); resolver.Resolve(Field <Project>(p => p.Name.Suffix(d["key2"]))); resolver.CachedFields.Should().Be(0); }
public void ExpressionWithConstantSuffix() { var resolver = new TestableFieldResolver(new ConnectionSettings()); var resolved = resolver.Resolve(Field<Project>(p => p.Name.Suffix("raw"))); resolver.CachedFields.Should().Be(1); resolved.Should().EndWith("raw"); resolved = resolver.Resolve(Field<Project>(p => p.Name.Suffix("foo"))); resolver.CachedFields.Should().Be(2); resolved.Should().EndWith("foo"); }
public void ExpressionWithVariableSuffix() { var suffix = "raw"; var resolver = new TestableFieldResolver(new ConnectionSettings()); var resolved = resolver.Resolve(Field<Project>(p => p.Name.Suffix(suffix))); resolved.Should().Be("name.raw"); resolver.CachedFields.Should().Be(0); suffix = "foo"; resolved = resolver.Resolve(Field<Project>(p => p.Name.Suffix(suffix))); resolved.Should().Be("name.foo"); resolver.CachedFields.Should().Be(0); }
public void ExpressionWithDictionaryItemVariableExpression() { var resolver = new TestableFieldResolver(new ConnectionSettings()); var key = "key1"; var resolved = resolver.Resolve(Field<Project>(p => p.Metadata[key])); resolver.CachedFields.Should().Be(0); resolved.Should().Contain(key); key = "key2"; resolved = resolver.Resolve(Field<Project>(p => p.Metadata[key])); resolver.CachedFields.Should().Be(0); resolved.Should().Contain(key); }
public void ExpressionWithDictionaryItemVariableExpressionAndEquivalentConstantSuffix() { var resolver = new TestableFieldResolver(new ConnectionSettings()); var key = "key1"; var resolved = resolver.Resolve(Field<Project>(p => p.Metadata[key].Suffix("x"))); resolver.CachedFields.Should().Be(0); resolved.Should().Be($"metadata.{key}.x"); key = "key2"; resolved = resolver.Resolve(Field<Project>(p => p.Metadata[key].Suffix("x"))); resolver.CachedFields.Should().Be(0); resolved.Should().Be($"metadata.{key}.x"); }
public void ExpressionWithDictionaryItemConstantExpressionAndConstantSuffix() { var resolver = new TestableFieldResolver(new ConnectionSettings()); var resolved = resolver.Resolve(Field<Project>(p => p.Metadata["key1"].Suffix("x"))); resolver.CachedFields.Should().Be(1); resolved.Should().Be("metadata.key1.x"); resolved = resolver.Resolve(Field<Project>(p => p.Metadata["key2"].Suffix("y"))); resolver.CachedFields.Should().Be(2); resolved.Should().Be("metadata.key2.y"); }
public void ExpressionWithDictionarySuffix() { var resolver = new TestableFieldResolver(new ConnectionSettings()); var key = "key1"; var d = new Dictionary<string, string> { { "key1", "raw" }, { "key2", "foo" } }; var resolved = resolver.Resolve(Field<Project>(p => p.Name.Suffix(d[key]))); resolved.Should().EndWith("raw"); resolver.CachedFields.Should().Be(0); resolver.Resolve(Field<Project>(p => p.Name.Suffix(d["key1"]))); resolver.CachedFields.Should().Be(0); key = "key2"; resolved = resolver.Resolve(Field<Project>(p => p.Name.Suffix(d[key]))); resolved.Should().EndWith("foo"); resolver.CachedFields.Should().Be(0); resolver.Resolve(Field<Project>(p => p.Name.Suffix(d["key2"]))); resolver.CachedFields.Should().Be(0); }
public void Expression() { var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve(Field<Project>(p => p.Name)); resolver.CachedFields.Should().Be(1); resolver.Resolve(Field<Project>(p => p.Name)); resolver.CachedFields.Should().Be(1); // Boost values should have no bearing on cached field names resolver.Resolve(Field<Project>(p => p.Name, 1.1)); resolver.CachedFields.Should().Be(1); }
public void SamePropertyTypesWithDifferentNames() { var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve(Property<TestFieldDocument>(c => c.ProjectA)); resolver.CachedProperties.Should().Be(1); resolver.Resolve(Property<TestFieldDocument>(c => c.ProjectB)); resolver.CachedProperties.Should().Be(2); }
public void SamePropertyTypesOnDifferentTypes() { var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve(Property<FirstTestFieldDocument>(c => c.Project.Name)); resolver.CachedProperties.Should().Be(1); resolver.Resolve(Property<SecondTestFieldDocument>(c => c.Project.Name)); resolver.CachedProperties.Should().Be(2); }
public void ExpressionWithSuffix() { var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve(Field<Project>(p => p.Name)); resolver.CachedFields.Should().Be(1); resolver.Resolve(Field<Project>(p => p.Name)); resolver.CachedFields.Should().Be(1); resolver.Resolve(Field<Project>(p => p.Name.Suffix("raw"))); resolver.CachedFields.Should().Be(2); resolver.Resolve(Field<Project>(p => p.Name.Suffix("raw"), 1.1)); resolver.CachedFields.Should().Be(2); }
public void ExpressionWithDifferentParameter() { var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve(Property<Project>(p => p.Name)); resolver.CachedProperties.Should().Be(1); resolver.Resolve(Property<Project>(d => d.Name)); resolver.CachedProperties.Should().Be(1); }
public void EquivalentExpressionsOnDifferentTypes() { var resolver = new TestableFieldResolver(new ConnectionSettings()); resolver.Resolve(Property<CommitActivity>(c => c.Id)); resolver.CachedProperties.Should().Be(1); resolver.Resolve(Property<Person>(c => c.Id)); resolver.CachedProperties.Should().Be(2); }