public void GetBytes_GuidProvided_BytesReturned() { TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes(Guid.NewGuid(), Endianness.LittleEndian); Assert.AreEqual(16, bytes.Length); }
public void GetBytes_EnumProvided_BytesReturned() { TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes(StringComparison.Ordinal, Endianness.LittleEndian); Assert.AreEqual(sizeof(int), bytes.Length); }
public void GetBytes_StringProvided_BytesReturned() { TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes("Test", Endianness.LittleEndian); Assert.IsTrue(bytes.Length > 0); }
public void IsValueType_ReferenceTypeProvided_FalseReturned() { TestConverter converter = new TestConverter(); bool result = converter.TestIsValueType(typeof(IList)); Assert.IsFalse(result); }
public void GetBytes_LongProvided_BytesReturned() { TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes(5L, Endianness.LittleEndian); Assert.AreEqual(sizeof(long), bytes.Length); }
public void IsValueType_PrimitiveTypeNameProvided_TrueReturned() { TestConverter converter = new TestConverter(); bool result = converter.TestIsValueType(typeof(int).AssemblyQualifiedName); Assert.IsTrue(result); }
public void IsValueType_DateTimeTypeProvided_TrueReturned() { TestConverter converter = new TestConverter(); bool result = converter.TestIsValueType(typeof(DateTime)); Assert.IsTrue(result); }
public void IsStringType_PrimitiveTypeProvided_FalseReturned() { TestConverter converter = new TestConverter(); bool result = converter.TestIsStringType(typeof(int)); Assert.IsFalse(result); }
public void IsStringType_StringTypeProvided_TrueReturned() { TestConverter converter = new TestConverter(); bool result = converter.TestIsStringType(typeof(string)); Assert.IsTrue(result); }
public void GetBytes_UShortProvided_BytesReturned() { TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes((ushort)5, Endianness.LittleEndian); Assert.AreEqual(sizeof(ushort), bytes.Length); }
public void TypeSize_DecimalTypeProvided_SizeReturned() { TestConverter converter = new TestConverter(); int result = converter.TestTypeSize(typeof(decimal)); Assert.AreEqual(sizeof(decimal), result); }
public void TypeSize_NullProvided_ZeroReturned() { TestConverter converter = new TestConverter(); int result = converter.TestTypeSize(null as Type); Assert.AreEqual(0, result); }
public void TypeSize_GuidTypeProvided_SizeReturned() { TestConverter converter = new TestConverter(); int result = converter.TestTypeSize(typeof(Guid)); Assert.AreEqual(16, result); }
public void TypeSize_UShortTypeProvided_SizeReturned() { TestConverter converter = new TestConverter(); int result = converter.TestTypeSize(typeof(ushort)); Assert.AreEqual(sizeof(ushort), result); }
public void TypeSize_DateTimeTypeProvided_SizeReturned() { TestConverter converter = new TestConverter(); int result = converter.TestTypeSize(typeof(DateTime)); Assert.AreEqual(sizeof(long), result); }
public void TypeSize_EnumTypeProvided_SizeReturned() { TestConverter converter = new TestConverter(); int result = converter.TestTypeSize(typeof(StringComparison)); Assert.AreEqual(sizeof(int), result); }
public void TypeSize_PrimitiveTypeNameProvided_SizeReturned() { TestConverter converter = new TestConverter(); int result = converter.TestTypeSize(typeof(int).AssemblyQualifiedName); Assert.AreEqual(sizeof(int), result); }
public void IsStringType_NullProvided_FalseReturned() { TestConverter converter = new TestConverter(); bool result = converter.TestIsStringType(null); Assert.IsFalse(result); }
public void IsValueType_EnumTypeProvided_TrueReturned() { TestConverter converter = new TestConverter(); bool result = converter.TestIsValueType(typeof(StringComparison)); Assert.IsTrue(result); }
public void GetBytes_BoolProvided_BytesReturned() { TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes(true, Endianness.LittleEndian); Assert.AreEqual(sizeof(bool), bytes.Length); Assert.AreEqual(1, bytes[0]); }
public void GetBytes_ByteProvided_BytesReturned() { byte b = 1; TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes(b, Endianness.LittleEndian); Assert.AreEqual(sizeof(byte), bytes.Length); Assert.AreEqual(b, bytes[0]); }
public void GetValue_FloatBytesProvided_FloatReturned() { float value = 6.5f; TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes(value, Endianness.LittleEndian); float result = converter.TestGetValue <float>(bytes, Endianness.LittleEndian); Assert.AreEqual(value, result); }
public void GetValue_DoubleBytesProvided_DoubleReturned() { double value = 3.9d; TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes(value, Endianness.LittleEndian); double result = converter.TestGetValue <double>(bytes, Endianness.LittleEndian); Assert.AreEqual(value, result); }
public void GetValue_ULongBytesProvided_ULongReturned() { ulong value = ulong.MaxValue - 1; TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes(value, Endianness.LittleEndian); ulong result = converter.TestGetValue <ulong>(bytes, Endianness.LittleEndian); Assert.AreEqual(value, result); }
public void GetValue_UIntBytesProvided_UIntReturned() { uint value = 512; TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes(value, Endianness.LittleEndian); uint result = converter.TestGetValue <uint>(bytes, Endianness.LittleEndian); Assert.AreEqual(value, result); }
public void GetValue_UShortBytesProvided_UShortReturned() { ushort value = 2048; TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes(value, Endianness.LittleEndian); ushort result = converter.TestGetValue <ushort>(bytes, Endianness.LittleEndian); Assert.AreEqual(value, result); }
public void GetValue_GuidBytesProvided_GuidReturned() { Guid value = Guid.NewGuid(); TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes(value, Endianness.LittleEndian); Guid result = converter.TestGetValue <Guid>(bytes, Endianness.LittleEndian); Assert.AreEqual(value, result); }
public void GetValue_DateTimeBytesProvided_DateTimeReturned() { DateTime value = DateTime.Now; TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes(value, Endianness.LittleEndian); DateTime result = converter.TestGetValue <DateTime>(bytes, Endianness.LittleEndian); Assert.AreEqual(value, result); }
public void GetValue_EnumBytesProvided_EnumReturned() { StringComparison value = StringComparison.Ordinal; TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes(value, Endianness.LittleEndian); StringComparison result = converter.TestGetValue <StringComparison>(bytes, Endianness.LittleEndian); Assert.AreEqual(value, result); }
public void GetValue_CharBytesProvided_CharReturned() { char value = 'a'; TestConverter converter = new TestConverter(); byte[] bytes = converter.TestGetBytes(value, Endianness.LittleEndian); char result = converter.TestGetValue <char>(bytes, Endianness.LittleEndian); Assert.AreEqual(value, result); }