public void ShouldNotEquals() { Reduce a; a = new Reduce(); Assert.IsFalse(a.Equals(null)); Assert.IsFalse(a.Equals(new Terminal(new Token("C", "a")))); Assert.IsFalse(a.Equals(new AnyTerminal())); }
public void ShouldNotEquals() { Reduce <char> a, b; a = new Reduce <char>("A", true, new MockedReduceInput(), null); b = new Reduce <char>("B", true, new MockedReduceInput(), null); Assert.IsFalse(a.Equals(b)); Assert.IsFalse(b.Equals(a)); }
public void ShouldEquals() { Reduce a, b; a = new Reduce(); b = new Reduce(); Assert.IsTrue(a.Equals(b)); Assert.IsTrue(b.Equals(a)); }
/// <summary> /// Equals the specified other. /// </summary> /// <param name="other">The other.</param> /// <param name="compareIndexIds">allow caller to choose whether to include the index Id in the comparison</param> /// <returns></returns> public bool Equals(IndexDefinition other, bool compareIndexIds = true, bool ignoreFormatting = false, bool ignoreMaxIndexOutput = false) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } if (compareIndexIds && !Equals(other.IndexId, IndexId)) { return(false); } bool mapsReduceEquals; if (ignoreFormatting) { #if !DNXCORE50 var comparer = new IndexPrettyPrinterEqualityComparer(); mapsReduceEquals = Maps.SequenceEqual(other.Maps, comparer) && comparer.Equals(Reduce, other.Reduce); #else mapsReduceEquals = Maps.SequenceEqual(other.Maps) && Reduce.Equals(other.Reduce); #endif } else { mapsReduceEquals = Maps.SequenceEqual(other.Maps) && Equals(other.Reduce, Reduce); } return(mapsReduceEquals && (ignoreMaxIndexOutput || other.MaxIndexOutputsPerDocument == MaxIndexOutputsPerDocument) && DictionaryExtensions.ContentEquals(other.Stores, Stores) && DictionaryExtensions.ContentEquals(other.Indexes, Indexes) && DictionaryExtensions.ContentEquals(other.Analyzers, Analyzers) && DictionaryExtensions.ContentEquals(other.SortOptions, SortOptions) && DictionaryExtensions.ContentEquals(other.Suggestions, Suggestions) && DictionaryExtensions.ContentEquals(other.TermVectors, TermVectors) && DictionaryExtensions.ContentEquals(other.SpatialIndexes, SpatialIndexes)); }