public void PrimitiveExactQueriesOrdinalsMatch() { FudgeMsg msg = StandardFudgeMessages.CreateMessageAllOrdinals(fudgeContext); Assert.Equal((sbyte)5, msg.GetSByte((short)3)); Assert.Equal((sbyte)5, msg.GetSByte((short)4)); short shortValue = ((short)sbyte.MaxValue) + 5; Assert.Equal(shortValue, msg.GetShort((short)5)); Assert.Equal(shortValue, msg.GetShort((short)6)); int intValue = ((int)short.MaxValue) + 5; Assert.Equal(intValue, msg.GetInt((short)7)); Assert.Equal(intValue, msg.GetInt((short)8)); long longValue = ((long)int.MaxValue) + 5; Assert.Equal(longValue, msg.GetLong((short)9)); Assert.Equal(longValue, msg.GetLong((short)10)); Assert.Equal(0.5f, msg.GetFloat((short)11)); Assert.Equal(0.5f, msg.GetFloat((short)12)); Assert.Equal(0.27362, msg.GetDouble((short)13)); Assert.Equal(0.27362, msg.GetDouble((short)14)); Assert.Equal("Kirk Wylie", msg.GetString((short)15)); }
public void PrimitiveExactQueriesNamesMatch() { FudgeMsg msg = StandardFudgeMessages.CreateMessageAllNames(fudgeContext); Assert.Equal((sbyte)5, msg.GetSByte("byte")); Assert.Equal((sbyte)5, msg.GetSByte("Byte")); short shortValue = ((short)sbyte.MaxValue) + 5; Assert.Equal(shortValue, msg.GetShort("short")); Assert.Equal(shortValue, msg.GetShort("Short")); int intValue = ((int)short.MaxValue) + 5; Assert.Equal(intValue, msg.GetInt("int")); Assert.Equal(intValue, msg.GetInt("Integer")); long longValue = ((long)int.MaxValue) + 5; Assert.Equal(longValue, msg.GetLong("long")); Assert.Equal(longValue, msg.GetLong("Long")); Assert.Equal(0.5f, msg.GetFloat("float")); Assert.Equal(0.5f, msg.GetFloat("Float")); Assert.Equal(0.27362, msg.GetDouble("double")); Assert.Equal(0.27362, msg.GetDouble("Double")); Assert.Equal("Kirk Wylie", msg.GetString("String")); }
public void PrimitiveExactQueriesOrdinalsNoMatch() { FudgeMsg msg = StandardFudgeMessages.CreateMessageAllOrdinals(fudgeContext); Assert.Throws <OverflowException>(() => msg.GetSByte(7)); Assert.Throws <OverflowException>(() => msg.GetShort(7)); Assert.Throws <OverflowException>(() => msg.GetInt(9)); Assert.Equal(((long)short.MaxValue) + 5, msg.GetLong(7)); Assert.Equal(0.27362f, msg.GetFloat(13)); Assert.Equal(0.5, msg.GetDouble(11)); }
public void PrimitiveExactQueriesNamesNoMatch() { FudgeMsg msg = StandardFudgeMessages.CreateMessageAllNames(fudgeContext); Assert.Throws <OverflowException>(() => msg.GetSByte("int")); Assert.Throws <OverflowException>(() => msg.GetShort("int")); Assert.Equal(5, msg.GetInt("byte")); Assert.Equal(((long)short.MaxValue) + 5, msg.GetLong("int")); Assert.Equal(0.27362f, msg.GetFloat("double")); Assert.Equal(0.5, msg.GetDouble("float")); }
public void PrimitiveExactOrdinalsNoOrdinals() { FudgeMsg msg = StandardFudgeMessages.CreateMessageAllOrdinals(fudgeContext); Assert.Null(msg.GetSByte((short)100)); Assert.Null(msg.GetShort((short)100)); Assert.Null(msg.GetInt((short)100)); Assert.Null(msg.GetLong((short)100)); Assert.Null(msg.GetFloat((short)100)); Assert.Null(msg.GetDouble((short)100)); Assert.Null(msg.GetString((short)100)); }
public void PrimitiveExactQueriesNoNames() { FudgeMsg msg = StandardFudgeMessages.CreateMessageAllNames(fudgeContext); Assert.Null(msg.GetSByte("foobar")); Assert.Null(msg.GetShort("foobar")); Assert.Null(msg.GetInt("foobar")); Assert.Null(msg.GetLong("foobar")); Assert.Null(msg.GetFloat("foobar")); Assert.Null(msg.GetDouble("foobar")); Assert.Null(msg.GetString("foobar")); }