public void Test_modification3_hash_set() { ModificationMotif.TryGetMotif("K", out ModificationMotif motif); ModificationWithMass m1 = new ModificationWithMass(null, new Tuple <string, string>("item1", "item2"), motif, ModificationSites.K, 1.11111d, new Dictionary <string, IList <string> >(), new List <double> { 2.222222 }, new List <double> { 1.2233 }, "modificationType"); ModificationWithMass m2 = new ModificationWithMass(null, new Tuple <string, string>("item1", "item2"), motif, ModificationSites.K, 1.11111d, new Dictionary <string, IList <string> >(), new List <double> { 2.222222 }, new List <double> { 1.2233 }, "modificationType"); m1.linksToOtherDbs.Add("key", new List <string> { "value" }); m2.linksToOtherDbs.Add("key", new List <string> { "value" }); HashSet <Modification> mods = new HashSet <Modification>(new Modification[] { m1, m2 }); Assert.AreEqual(1, mods.Count); Assert.True(m1.Equals(m2)); }
public void Test_modification3_hash_set() { ModificationMotif.TryGetMotif("K", out ModificationMotif motif); ModificationWithMass m1 = new ModificationWithMass("id1", "modificationType", motif, TerminusLocalization.Any, 1.11111d, new Dictionary <string, IList <string> >(), neutralLosses: new List <double> { 2.222222 }, diagnosticIons: new List <double> { 1.2233 }); ModificationWithMass m2 = new ModificationWithMass("id1", "modificationType", motif, TerminusLocalization.Any, 1.11111d - 1e-10, new Dictionary <string, IList <string> >(), neutralLosses: new List <double> { 2.222222 + 1e-10 }, diagnosticIons: new List <double> { 1.2233 }); m1.linksToOtherDbs.Add("key", new List <string> { "value" }); m2.linksToOtherDbs.Add("key", new List <string> { "value" }); HashSet <Modification> mods = new HashSet <Modification>(new Modification[] { m1, m2 }); Assert.AreEqual(1, mods.Count); Assert.True(m1.Equals(m2)); }