Exemplo n.º 1
0
        public void ConstructorTest()
        {
            // arrange
            // act
            var target = new TagEnd();

            // assert
            Assert.Empty(target.Name);
        }
Exemplo n.º 2
0
        public void SetValue_throws_exception()
        {
            // arrange
            var target = new TagEnd();

            // act
            var e = Assert.Throws <NotSupportedException>(() => target.SetValue("TEST"));

            Assert.Equal("Tag does not support values.", e.Message);
        }
Exemplo n.º 3
0
        public void SetValue_throws_exception()
        {
            // arrange
            TagEnd target;

            target = new TagEnd();

            // act
            target.SetValue("TEST");
        }
Exemplo n.º 4
0
        public void GetValue_throws_exception()
        {
            // arrange
            TagEnd target;

            target = new TagEnd();

            // act
            target.GetValue();
        }
Exemplo n.º 5
0
        public void ToValueString_returns_empty_value()
        {
            // arrange
            var target = new TagEnd();

            // act
            var actual = target.ToValueString();

            // assert
            Assert.Empty(actual);
        }
Exemplo n.º 6
0
        public void TypeTest()
        {
            // arrange
            const TagType expected = TagType.End;

            // act
            var actual = new TagEnd().Type;

            // assert
            Assert.Equal(expected, actual);
        }
Exemplo n.º 7
0
        public void ConstructorTest()
        {
            // arrange
            TagEnd target;

            // act
            target = new TagEnd();

            // assert
            Assert.IsEmpty(target.Name);
        }
Exemplo n.º 8
0
        public void ToStringTest()
        {
            // arrange
            const string expected = "[End]";
            var          target   = new TagEnd();

            // act
            var actual = target.ToString();

            // assert
            Assert.Equal(expected, actual);
        }
Exemplo n.º 9
0
    public void ConstructorTest()
    {
      // arrange
      TagEnd target;

      // act
      target = new TagEnd();

      // assert
      Assert.IsEmpty(target.Name);
      Assert.IsNull(target.Value);
    }
Exemplo n.º 10
0
        public void Equals_returns_true_for_any_end_tag()
        {
            // arrange
            var target = new TagEnd();
            var other  = new TagEnd();

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

            // assert
            Assert.True(actual);
        }
Exemplo n.º 11
0
    public void ConstructorWithValueTest()
    {
      // arrange
      TagEnd tag;

      // act
      tag = new TagEnd();

      // assert
      Assert.IsEmpty(tag.Name);
      Assert.IsNull(tag.Value);
    }
Exemplo n.º 12
0
        public void GetHashCode_returns_same_value()
        {
            // arrange
            var target   = new TagEnd();
            var expected = new TagEnd().GetHashCode();

            // act
            var actual = target.GetHashCode();

            // assert
            Assert.Equal(expected, actual);
        }
Exemplo n.º 13
0
        public void ToValueString_returns_empty_value()
        {
            // arrange
            TagEnd target;
            string actual;

            target = new TagEnd();

            // act
            actual = target.ToValueString();

            // assert
            Assert.IsEmpty(actual);
        }
Exemplo n.º 14
0
        public void TypeTest()
        {
            // arrange
            TagType expected;
            TagType actual;

            expected = TagType.End;

            // act
            actual = new TagEnd().Type;

            // assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 15
0
    public void NameTest()
    {
      // arrange
      TagEnd target;
      string expected;

      target = new TagEnd();
      expected = "newvalue";

      // act
      target.Name = expected;

      // assert
      Assert.IsEmpty(target.Name);
    }
Exemplo n.º 16
0
    public void ToStringTest()
    {
      // arrange
      TagEnd target;
      string expected;
      string actual;

      expected = "[End]";
      target = new TagEnd();

      // act
      actual = target.ToString();

      // assert
      Assert.AreEqual(expected, actual);
    }
Exemplo n.º 17
0
        public void ToStringTest()
        {
            // arrange
            TagEnd target;
            string expected;
            string actual;

            expected = "[End]";
            target   = new TagEnd();

            // act
            actual = target.ToString();

            // assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 18
0
        public void Equals_returns_true_for_any_end_tag()
        {
            // arrange
            TagEnd target;
            TagEnd other;
            bool   actual;

            target = new TagEnd();
            other  = new TagEnd();

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

            // assert
            Assert.IsTrue(actual);
        }
Exemplo n.º 19
0
        public void GetHashCode_returns_same_value()
        {
            // arrange
            TagEnd target;
            int    expected;
            int    actual;

            target = new TagEnd();

            expected = new TagEnd().GetHashCode();

            // act
            actual = target.GetHashCode();

            // assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 20
0
    public void ToStringWithIndentTest()
    {
      // arrange
      TagEnd target;
      string expected;
      string actual;
      string prefix;

      prefix = "test";
      expected = string.Format("{0}[End]", prefix);
      target = new TagEnd();

      // act
      actual = target.ToString(prefix);

      // assert
      Assert.AreEqual(expected, actual);
    }
Exemplo n.º 21
0
    public virtual TagCollection ReadCollection(TagList owner)
    {
      TagCollection tags;
      int length;

      owner.ListType = (TagType)this.ReadByte();
      tags = new TagCollection(owner, owner.ListType);
      length = this.ReadInt();

      for (int i = 0; i < length; i++)
      {
        ITag tag;

        switch (owner.ListType)
        {
          case TagType.Byte:
            tag = TagFactory.CreateTag(TagType.Byte, this.ReadByte());
            break;

          case TagType.ByteArray:
            tag = TagFactory.CreateTag(TagType.ByteArray, this.ReadByteArray());
            break;

          case TagType.Compound:
            tag = TagFactory.CreateTag(TagType.Compound);
            tag.Value = this.ReadDictionary((TagCompound)tag);
            break;

          case TagType.Double:
            tag = TagFactory.CreateTag(TagType.Double, this.ReadDouble());
            break;

          case TagType.End:
            tag = new TagEnd();
            break;

          case TagType.Float:
            tag = TagFactory.CreateTag(TagType.Float, this.ReadFloat());
            break;

          case TagType.Int:
            tag = TagFactory.CreateTag(TagType.Int, this.ReadInt());
            break;

          case TagType.IntArray:
            tag = TagFactory.CreateTag(TagType.IntArray, this.ReadIntArray());
            break;

          case TagType.List:
            tag = TagFactory.CreateTag(TagType.List);
            tag.Value = this.ReadCollection((TagList)tag);
            break;

          case TagType.Long:
            tag = TagFactory.CreateTag(TagType.Long, this.ReadLong());
            break;

          case TagType.Short:
            tag = TagFactory.CreateTag(TagType.Short, this.ReadShort());
            break;

          case TagType.String:
            tag = TagFactory.CreateTag(TagType.String, this.ReadString());
            break;

          default:
            throw new InvalidDataException("Invalid list type.");
        }

        tags.Add(tag);
      }

      return tags;
    }
Exemplo n.º 22
0
    public void ValueTest()
    {
      // arrange
      TagEnd target;
      byte expected;

      target = new TagEnd();
      expected = byte.MaxValue;

      // act
      target.Value = expected; // TagEnd has no name or value

      // assert
      Assert.IsNull(target.Value);
    }
Exemplo n.º 23
0
    public void TypeTest()
    {
      // arrange
      TagType expected;
      TagType actual;

      expected = TagType.End;

      // act
      actual = new TagEnd().Type;

      // assert
      Assert.AreEqual(expected, actual);
    }