/// <summary> /// Adds a new <see cref="Int32AssociationFacetField"/> using <paramref name="dim"/> and <paramref name="path"/> and an /// <see cref="int"/> association. /// </summary> /// <param name="document">This <see cref="Document"/>.</param> /// <param name="assoc">Associated value.</param> /// <param name="dim">Dimension for this field.</param> /// <param name="path">Facet path for this field.</param> /// <returns>The field that was added to this <see cref="Document"/>.</returns> public static Int32AssociationFacetField AddInt32AssociationFacetField(this Document document, int assoc, string dim, params string[] path) { var field = new Int32AssociationFacetField(assoc, dim, path); document.Add(field); return(field); }
public void TestAddInt32AssociationFacetField() { Int32AssociationFacetField field = null; int assoc = 1234; string[] path = new[] { "thePath0", "thePath1", "thePath2" }; AssertDocumentExtensionAddsToDocument(document => field = document.AddInt32AssociationFacetField(assoc, "theDim", path)); Assert.AreEqual(Int32AssociationFacetField.Int32ToBytesRef(assoc), field.Assoc); Assert.AreEqual("theDim", field.Dim); Assert.AreEqual(path, field.Path); }
/// <summary> /// Adds a new <see cref="Int32AssociationFacetField"/> using <paramref name="dim"/> and <paramref name="path"/> and an /// <see cref="int"/> association. /// </summary> /// <param name="document">This <see cref="Document"/>.</param> /// <param name="assoc">Associated value.</param> /// <param name="dim">Dimension for this field.</param> /// <param name="path">Facet path for this field.</param> /// <returns>The field that was added to this <see cref="Document"/>.</returns> /// <exception cref="ArgumentNullException">This <paramref name="document"/> is <c>null</c>. </exception> public static Int32AssociationFacetField AddInt32AssociationFacetField(this Document document, int assoc, string dim, params string[] path) { if (document is null) { throw new ArgumentNullException(nameof(document)); } var field = new Int32AssociationFacetField(assoc, dim, path); document.Add(field); return(field); }