예제 #1
0
        public void KeyCollection_Equal_False()
        {
            var a1 = new KeyCollection(new object[] { 100, "a", true, new DateTime(2015, 05, 12) });
            var a2 = new KeyCollection(new object[] { 100, "a", false, new DateTime(2015, 05, 12) });

            var dico = new Dictionary<KeyCollection, object>();
            dico.Add(a1, null);

            Assert.That(a1, Is.Not.EqualTo(a2));
            Assert.That(a1.GetHashCode(), Is.Not.EqualTo(a2.GetHashCode()));
            Assert.That(dico.ContainsKey(a2), Is.Not.True);
        }
예제 #2
0
        public void KeyCollection_Equal_False()
        {
            var a1 = new KeyCollection(new object[] { 100, "a", true, new DateTime(2015, 05, 12) });
            var a2 = new KeyCollection(new object[] { 100, "a", false, new DateTime(2015, 05, 12) });

            var dico = new Dictionary <KeyCollection, object>();

            dico.Add(a1, null);

            Assert.That(a1, Is.Not.EqualTo(a2));
            Assert.That(a1.GetHashCode(), Is.Not.EqualTo(a2.GetHashCode()));
            Assert.That(dico.ContainsKey(a2), Is.Not.True);
        }
예제 #3
0
        public void KeyCollectionWithNullVersusEmpty_Equal_False()
        {
            var a1 = new KeyCollection(new object[] { 100, DBNull.Value, true, new DateTime(2015, 05, 12) });
            var a2 = new KeyCollection(new object[] { 100, string.Empty, true, new DateTime(2015, 05, 12) });

            var dico = new Dictionary <KeyCollection, object>
            {
                { a1, null }
            };

            Assert.That(a1, Is.Not.EqualTo(a2));
            Assert.That(a1.GetHashCode(), Is.Not.EqualTo(a2.GetHashCode()));
            Assert.That(dico.ContainsKey(a2), Is.Not.True);
        }