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)); }
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)); }
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()); }
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()); }