示例#1
0
        static void Main(string[] args)
        {
            var pgm  = new Program();
            var tag1 = PopulateTag();

            Console.WriteLine("Validation: {0}", TagLoader.ValidateAll(tag1, pgm));
            TagLoader.LoadAll(tag1, pgm);
            Console.WriteLine("Loaded all tags");
            var tag2 = TagSaver.SaveAll(pgm);

            Console.WriteLine("Saved all tags");
            Console.WriteLine("Tags are same: {0}", TagCompound.Equals(tag1, tag2));
            Console.ReadKey();
        }
        public void Equals_returns_false_with_different_value()
        {
            // arrange
            TagCompound target;
            TagCompound other;
            bool        actual;

            target = new TagCompound(string.Empty, new TagDictionary {
                new TagByte("A", 2), new TagShort("B", 4), new TagInt("C", 8)
            });
            other = new TagCompound(string.Empty, new TagDictionary {
                new TagByte("A", 2), new TagShort("B", 4), new TagInt("C", 16)
            });

            // act
            actual = target.Equals(other);

            // assert
            Assert.False(actual);
        }
        public void Equals_returns_true_for_matching_tag()
        {
            // arrange
            TagCompound target;
            TagCompound other;
            bool        actual;

            target = new TagCompound("alpha", new TagDictionary {
                new TagByte("A", 2), new TagShort("B", 4), new TagInt("C", 8)
            });
            other = new TagCompound("alpha", new TagDictionary {
                new TagByte("A", 2), new TagShort("B", 4), new TagInt("C", 8)
            });

            // act
            actual = target.Equals(other);

            // assert
            Assert.True(actual);
        }
示例#4
0
        public void Equals_returns_false_with_different_name()
        {
            // arrange
            TagCompound target;
            TagCompound other;
            bool        actual;

            target = new TagCompound("Alpha", new TagDictionary {
                new TagByte("A", 2), new TagShort("B", 4), new TagInt("C", 8)
            });
            other = new TagCompound("Beta", new TagDictionary {
                new TagByte("A", 2), new TagShort("B", 4), new TagInt("C", 8)
            });

            // act
            actual = target.Equals(other);

            // assert
            Assert.IsFalse(actual);
        }