public void ContainsAnyThrowsIfAccessed() { var set = new[] { 1, 2, 3 }; var ex = Assert.Throws <InvalidOperationException>(() => ElasticMethods.ContainsAny(set, set)); Assert.Contains("ElasticMethods.ContainsAny", ex.Message); }
public static void ContainsAny_ListFirst_CreatesTermsQuery() { var matchNames = new[] { "Robbie", "Kryten", "IG-88", "Marvin" }; var where = Robots.Where(r => ElasticMethods.ContainsAny(matchNames, r.Aliases)); var criteria = ElasticQueryTranslator.Translate(Mapping, "prefix", where.Expression).SearchRequest.Filter; var termsCriteria = Assert.IsType <TermsCriteria>(criteria); Assert.Equal("prefix.aliases", termsCriteria.Field); Assert.Contains("Robbie", termsCriteria.Values); Assert.Contains("Kryten", termsCriteria.Values); Assert.Contains("IG-88", termsCriteria.Values); Assert.Contains("Marvin", termsCriteria.Values); Assert.Equal(TermsExecutionMode.@bool, termsCriteria.ExecutionMode); }