static TextConverterTest() { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Encoding = Encoding.GetEncoding(932); EmptyBytes = TestBytes.Offset(Offset, Encoding.GetBytes(string.Empty.PadRight(Length, ' '))); ValueBytes = TestBytes.Offset(Offset, Encoding.GetBytes(Value.PadRight(Length - (Encoding.GetByteCount(Value) - Value.Length), ' '))); OverflowBytes = TestBytes.Offset(Offset, Encoding.GetBytes(OverflowValue.Substring(0, Length))); }
public bool Equals(TestClass other) { return(((TestString == other.TestString) && (TestBytes == null) && (other.TestBytes == null)) || ((TestBytes != null) && (other.TestBytes != null) && TestBytes.SequenceEqual(other.TestBytes) && (TestInt == other.TestInt) && (TestDateTime == other.TestDateTime) && (TestClassInstance == null) && (other.TestClassInstance == null)) || ((TestClassInstance != null) && (other.TestClassInstance != null) && TestClassInstance.Equals(other.TestClassInstance) && (TestBool == other.TestBool))); }
public bool Equals(TestClass other) { return(TestString == other.TestString && TestBytes == null && other.TestBytes == null || TestBytes != null && other.TestBytes != null && TestBytes.SequenceEqual(other.TestBytes) && TestInt == other.TestInt && TestDateTime == other.TestDateTime && TestClassInstance == null && other.TestClassInstance == null || TestClassInstance != null && other.TestClassInstance != null && TestClassInstance.Equals(other.TestClassInstance) && TestBool == other.TestBool); }
static BytesConverterTest() { ValueBytes = TestBytes.Offset(Offset, Value); ShortValueBytes = TestBytes.Offset(Offset, ShortValue.Combine(new byte[Length - ShortValue.Length])); EmptyBytes = TestBytes.Offset(Offset, new byte[Length]); }
public void ByteArray_ToHex_returns_hex_string() { Assert.Equal("", new byte[] { }.ToHex()); Assert.Equal(TestHex, TestBytes.ToHex()); }
public void ByteArray_ToUtf8_returns_string() { Assert.Equal("", new byte[] { }.ToUtf8()); Assert.Equal(TestString, TestBytes.ToUtf8()); }
static UnicodeConverterTest() { EmptyBytes = TestBytes.Offset(Offset, Encoding.Unicode.GetBytes(string.Empty.PadRight(Length / 2, ' '))); ValueBytes = TestBytes.Offset(Offset, Encoding.Unicode.GetBytes(Value.PadRight(Length / 2, ' '))); OverflowBytes = TestBytes.Offset(Offset, Encoding.Unicode.GetBytes(OverflowValue.Substring(0, Length / 2))); }
static AsciiConverterTest() { EmptyBytes = TestBytes.Offset(Offset, Encoding.ASCII.GetBytes(string.Empty.PadRight(Length, ' '))); ValueBytes = TestBytes.Offset(Offset, Encoding.ASCII.GetBytes(Value.PadRight(Length, ' '))); OverflowBytes = TestBytes.Offset(Offset, Encoding.ASCII.GetBytes(OverflowValue.Substring(0, Length))); }
public void ByteArray_ToHex_returns_hex_string() { Assert.That(new byte[] {}.ToHex(), Is.EqualTo("")); Assert.That(TestBytes.ToHex(), Is.EqualTo(TestHex)); }
public void ByteArray_ToUtf8_returns_string() { Assert.That(new byte[] {}.ToUtf8(), Is.EqualTo("")); Assert.That(TestBytes.ToUtf8(), Is.EqualTo(TestString)); }