public void CompareToGreaterThan() { var v1 = ReadOnlyFixedBytes.Parse("AB"); var v2 = ReadOnlyFixedBytes.Parse("AA"); Assert.Equal(1, v1.CompareTo(v2)); }
public void InequalityOperatorFalse() { var v1 = ReadOnlyFixedBytes.Parse("AA"); var v2 = ReadOnlyFixedBytes.Parse("AA"); Assert.False(v1 != v2); }
public void EqualityOperatorTrue() { var v1 = ReadOnlyFixedBytes.Parse("AA"); var v2 = ReadOnlyFixedBytes.Parse("AA"); Assert.True(v1 == v2); }
public void CompareToEqual() { var v1 = ReadOnlyFixedBytes.Parse("AA"); var v2 = ReadOnlyFixedBytes.Parse("AA"); Assert.Equal(0, v1.CompareTo(v2)); }
public void GetHashCodeNotEqual() { var v1 = ReadOnlyFixedBytes.Parse("AA"); var v2 = ReadOnlyFixedBytes.Parse("AB"); Assert.NotEqual(v1.GetHashCode(), v2.GetHashCode()); }
public void EqualsObject() { var v1 = ReadOnlyFixedBytes.Parse("AA"); var v2 = ReadOnlyFixedBytes.Parse("AA"); Assert.True(v1.Equals((object)v2)); }
public void EqualsOther() { var v1 = ReadOnlyFixedBytes.Parse("AA"); var v2 = ReadOnlyFixedBytes.Parse("AA"); Assert.True(v1.Equals(v2)); }
public void ConstructFromStringThrowsOnInvalid(string value) { Action action = () => Assert.Null(ReadOnlyFixedBytes.Parse(value)); ArgumentException e = Assert.Throws <ArgumentException>(action); Assert.Contains("is not a recognized hex string", e.Message, StringComparison.OrdinalIgnoreCase); }
public void StringRoundtrip() { var v1 = ReadOnlyFixedBytes.Random(); var serialized = v1.Serialize(); var v2 = ReadOnlyFixedBytes.Parse(serialized); Assert.Equal(v1, v2); }
public void InequalityOperatorTrue() { var v1 = ReadOnlyFixedBytes.Parse("AA"); var v2 = ReadOnlyFixedBytes.Parse("AB"); Assert.True(v1 != v2); Assert.True(v1 < v2); Assert.False(v1 > v2); Assert.False(v2 < v1); Assert.True(v2 > v1); }
public void ConstructFromStringZeroPads(string value) { var v = ReadOnlyFixedBytes.Parse(value); Assert.Equal(ReadOnlyFixedBytes.MaxHexLength - 2, v.ToHex().LastIndexOf("00", StringComparison.Ordinal)); }
public void SerializeToString() { Assert.Equal("770000000000000000000000000000000000000000000000000000000000000000", ReadOnlyFixedBytes.Parse("77").Serialize()); }
public void ToStringIsToHex() { var v = ReadOnlyFixedBytes.Parse("ABCD"); Assert.Equal(v.ToHex(), v.ToString()); }
public void ToHexIsUppercase() { Assert.Equal("BB00", ReadOnlyFixedBytes.Parse("bb").ToHex(2)); }
public void ToHexLimit() { Assert.Equal("BB00", ReadOnlyFixedBytes.Parse("BB").ToHex(2)); }
public void ToHexZeroPads() { Assert.Equal("BB0000000000000000000000000000000000000000000000000000000000000000", ReadOnlyFixedBytes.Parse("BB").ToHex()); }