示例#1
0
        public void ContentsEqual()
        {
            JsonValue array1 = new JsonArray {
                1, false
            };
            JsonValue array2 = new JsonArray {
                1, false
            };

            Assert.IsTrue(array1.Equals(array2));
        }
示例#2
0
        public void SequenceEqual()
        {
            JsonValue array1 = new JsonArray {
                1, false
            };
            JsonValue array2 = new JsonArray {
                1, false
            };

            Assert.IsTrue(array1.Equals(array2));
        }
示例#3
0
        public void SequenceNotEqual()
        {
            JsonValue array1 = new JsonArray {
                1, false
            };
            JsonValue array2 = new JsonArray {
                false, 1
            };

            Assert.IsFalse(array1.Equals(array2));
        }
示例#4
0
        public void Equals_SameValuesSameOrder_ReturnsTrue()
        {
            var json1 = new JsonArray {
                false, 42, "a string"
            };
            var json2 = new JsonArray {
                false, 42, "a string"
            };

            Assert.IsTrue(json1.Equals(json2));
        }
示例#5
0
        public void Equals_DifferentValues_ReturnsFalse()
        {
            var json1 = new JsonArray {
                false, 42, "a string"
            };
            var json2 = new JsonArray {
                false, "42", "a string"
            };

            Assert.IsFalse(json1.Equals(json2));
        }
示例#6
0
        public void Equals_SameValuesDifferentOrder_ReturnsFalse()
        {
            var json1 = new JsonArray {
                false, 42, "a string"
            };
            var json2 = new JsonArray {
                42, false, "a string"
            };

            Assert.IsFalse(json1.Equals(json2));
        }
示例#7
0
        public void SequenceEqualOverride()
        {
            JsonValue array1 = new JsonArray {
                1, false
            };

            array1.Array.EqualityStandard = ArrayEquality.ContentsEqual;
            JsonValue array2 = new JsonArray {
                false, 1
            };

            Assert.IsTrue(array1.Equals(array2));
        }
示例#8
0
        public void ContentsNotEqual()
        {
            JsonOptions.DefaultArrayEquality = ArrayEquality.ContentsEqual;

            JsonValue array1 = new JsonArray {
                1, false
            };
            JsonValue array2 = new JsonArray {
                false, 1
            };

            try
            {
                Assert.IsTrue(array1.Equals(array2));
            }
            finally
            {
                JsonOptions.DefaultArrayEquality = ArrayEquality.SequenceEqual;
            }
        }
示例#9
0
        public void ContentsNotEqualOverride()
        {
            JsonOptions.DefaultArrayEquality = ArrayEquality.ContentsEqual;

            JsonValue array1 = new JsonArray {
                1, false
            };

            array1.Array.EqualityStandard = ArrayEquality.SequenceEqual;
            JsonValue array2 = new JsonArray {
                false, 1
            };

            try
            {
                Assert.IsFalse(array1.Equals(array2));
            }
            finally
            {
                JsonOptions.DefaultArrayEquality = ArrayEquality.SequenceEqual;
            }
        }
示例#10
0
        public void AddData(JsonArray a, MainActivity.MovieType type)
        {
            JsonArray write;

            switch (type)
            {
            case MainActivity.MovieType.ALSO:
                if (also.Equals(a))
                {
                    return;
                }
                write = also = a;
                break;

            case MainActivity.MovieType.OPEN:
                if (open.Equals(a))
                {
                    return;
                }
                write = open = a;
                break;

            case MainActivity.MovieType.TOP:
                if (top.Equals(a))
                {
                    return;
                }
                write = top = a;
                break;

            default:
                return;
            }
            WriteJson(write, type);
            NotifyDataSetChanged();
        }