Exemplo n.º 1
0
        public void CompareTo_Works()
        {
            var key = new AttributeKey();

            key.ReadFrom(Convert.FromBase64String("AC4AAAAAABcAAAAAABEAYwBvAG0ALgBhAHAAcABsAGUALgBkAGUAYwBtAHAAZgBz"), 0);

            var other = new AttributeKey();

            key.ReadFrom(Convert.FromBase64String("AC4AAAAAABcAAAAAABEAYwBvAG0ALgBhAHAAcABsAGUALgBkAGUAYwBtAHAAZgBz"), 0);

            Assert.Equal(0, key.CompareTo(key));
            Assert.Equal(1, key.CompareTo(other));
            Assert.Equal(-1, other.CompareTo(key));
        }
Exemplo n.º 2
0
        public void Equal_Works()
        {
            var key = new AttributeKey();

            key.ReadFrom(Convert.FromBase64String("AC4AAAAAABcAAAAAABEAYwBvAG0ALgBhAHAAcABsAGUALgBkAGUAYwBtAHAAZgBz"), 0);

            var other = new AttributeKey();

            key.ReadFrom(Convert.FromBase64String("AC4AAAAAABcAAAAAABEAYwBvAG0ALgBhAHAAcABsAGUALgBkAGUAYwBtAHAAZgBz"), 0);

            Assert.True(key.Equals(key));
            Assert.False(other.Equals(key));
            Assert.False(key.Equals(other));
            Assert.False(key.Equals(null));
        }
Exemplo n.º 3
0
        public void HashCode_Works()
        {
            var key = new AttributeKey();

            key.ReadFrom(Convert.FromBase64String("AC4AAAAAABcAAAAAABEAYwBvAG0ALgBhAHAAcABsAGUALgBkAGUAYwBtAHAAZgBz"), 0);

            var clone = new AttributeKey();

            clone.ReadFrom(Convert.FromBase64String("AC4AAAAAABcAAAAAABEAYwBvAG0ALgBhAHAAcABsAGUALgBkAGUAYwBtAHAAZgBz"), 0);

            var other = new AttributeKey();

            key.ReadFrom(Convert.FromBase64String("AC4AAAAAABcAAAAAABEAYwBvAG0ALgBhAHAAcABsAGUALgBkAGUAYwBtAHAAZgBz"), 0);

            Assert.Equal(key.GetHashCode(), key.GetHashCode());
            Assert.Equal(key.GetHashCode(), clone.GetHashCode());
            Assert.NotEqual(other.GetHashCode(), key.GetHashCode());
        }
Exemplo n.º 4
0
        public void ReadFrom_Works()
        {
            var data = Convert.FromBase64String("AC4AAAAAABcAAAAAABEAYwBvAG0ALgBhAHAAcABsAGUALgBkAGUAYwBtAHAAZgBz");

            var key = new AttributeKey();

            key.ReadFrom(data, 0);

            Assert.Equal(new CatalogNodeId(23), key.FileId);
            Assert.Equal("com.apple.decmpfs", key.Name);
            Assert.Equal(0x30, key.Size);

            Assert.Equal("com.apple.decmpfs (23)", key.ToString());
        }