public void NotEvenClose()
        {
            string x = "a";
            string y = "It was the best of times, it was the worse of times";
            SpookyStringEqualityComparer eq = new SpookyStringEqualityComparer();

            Assert.False(eq.Equals(x, y));
            Assert.False(eq.Equals(x, y.ToCharArray()));
            Assert.False(eq.Equals(x.ToCharArray(), y));
            Assert.False(eq.Equals(x.ToCharArray(), y.ToCharArray()));
        }
        public void RollAlong()
        {
            char[] x = new char[65];
            char[] y = new char[65];
            SpookyStringEqualityComparer eq = new SpookyStringEqualityComparer();

            for (int i = 0; i != x.Length; ++i)
            {
                x[i] = (char)(i + 'a');
                Assert.False(eq.Equals(x, y));
                y[i] = (char)(i + 'a');
            }

            Assert.True(eq.Equals(x, y));
        }
        public void NullsAndReferencesCorrect()
        {
            string str = "abcdefg";

            char[] arr = "abcdefg".ToCharArray();
            SpookyStringEqualityComparer eq = new SpookyStringEqualityComparer();

            Assert.True(eq.Equals(arr, arr));
            Assert.True(eq.Equals(default(string), default(string)));
            Assert.True(eq.Equals(default(string), default(char[])));
            Assert.True(eq.Equals(default(char[]), default(string)));
            Assert.True(eq.Equals(default(char[]), default(char[])));
            Assert.False(eq.Equals(arr, default(char[])));
            Assert.False(eq.Equals(default(char[]), arr));
            Assert.False(eq.Equals(arr, default(string)));
            Assert.False(eq.Equals(default(string), arr));
            Assert.False(eq.Equals(default(string), str));
            Assert.False(eq.Equals(str, default(string)));
            Assert.False(eq.Equals(str, default(char[])));
        }
 public void NullsAndReferencesCorrect()
 {
     var str = "abcdefg";
     var arr = "abcdefg".ToCharArray();
     char[] nulArr = null;
     string nulStr = null;
     var eq = new SpookyStringEqualityComparer();
     Assert.True(eq.Equals(arr, arr));
     Assert.True(eq.Equals(nulStr, nulStr));
     Assert.True(eq.Equals(nulStr, nulArr));
     Assert.True(eq.Equals(nulArr, nulStr));
     Assert.True(eq.Equals(nulArr, nulArr));
     Assert.False(eq.Equals(arr, nulArr));
     Assert.False(eq.Equals(nulArr, arr));
     Assert.False(eq.Equals(arr, nulStr));
     Assert.False(eq.Equals(nulStr, arr));
     Assert.False(eq.Equals(nulStr, str));
     Assert.False(eq.Equals(str, nulStr));
     Assert.False(eq.Equals(str, nulArr));
 }
 public void NotEvenClose()
 {
     string x = "a";
     string y = "It was the best of times, it was the worse of times";
     var eq = new SpookyStringEqualityComparer();
     Assert.False(eq.Equals(x, y));
     Assert.False(eq.Equals(x, y.ToCharArray()));
     Assert.False(eq.Equals(x.ToCharArray(), y));
     Assert.False(eq.Equals(x.ToCharArray(), y.ToCharArray()));
 }
 public void RollAlong()
 {
     var x = new char[65];
     var y = new char[65];
     var eq = new SpookyStringEqualityComparer();
     for(int i = 0; i != x.Length; ++i)
     {
         x[i] = (char)(i + (int)'a');
         Assert.False(eq.Equals(x, y));
         y[i] = (char)(i + (int)'a');
     }
     Assert.True(eq.Equals(x, y));
 }