public void AllOrdinalsCodecWithTaxonomy() { FudgeContext context = new FudgeContext(); FudgeMsg inputMsg = context.NewMessage(); inputMsg.Add(ORDINALS[0], "value1"); inputMsg.Add(ORDINALS[1], "value2"); inputMsg.Add(ORDINALS[2], "value3"); inputMsg.Add(ORDINALS[3], "value4"); var resolverMap = new Dictionary <int, IFudgeTaxonomy>(); resolverMap.Add(45, new MapFudgeTaxonomy(ORDINALS, NAMES)); context.TaxonomyResolver = new ImmutableMapTaxonomyResolver(resolverMap); FudgeMsg outputMsg = CycleMessage(inputMsg, context, (short)45); Assert.Equal("value1", outputMsg.GetString(NAMES[0])); Assert.Equal("value1", outputMsg.GetString(ORDINALS[0])); Assert.Equal("value2", outputMsg.GetString(NAMES[1])); Assert.Equal("value2", outputMsg.GetString(ORDINALS[1])); Assert.Equal("value3", outputMsg.GetString(NAMES[2])); Assert.Equal("value3", outputMsg.GetString(ORDINALS[2])); Assert.Equal("value4", outputMsg.GetString(NAMES[3])); Assert.Equal("value4", outputMsg.GetString(ORDINALS[3])); }
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 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")); }
private Tuple <UniqueId, ILocalDateDoubleTimeSeries> DecodePairMessage(FudgeMsg message) { if (message == null) { return(new Tuple <UniqueId, ILocalDateDoubleTimeSeries>(null, null)); } var uniqueIdString = message.GetString("uniqueId"); if (uniqueIdString == null) { throw new ArgumentException("uniqueId not present in message"); } var timeSeriesField = (FudgeMsg)message.GetMessage("timeSeries"); if (timeSeriesField == null) { throw new ArgumentException("timeSeries not present in message"); } return(Tuple.Create(UniqueId.Parse(uniqueIdString), _fudgeContext.GetSerializer().Deserialize <ILocalDateDoubleTimeSeries>(timeSeriesField))); }
private Tuple<UniqueId, ILocalDateDoubleTimeSeries> DecodePairMessage(FudgeMsg message) { if (message == null) { return new Tuple<UniqueId, ILocalDateDoubleTimeSeries>(null, null); } var uniqueIdString = message.GetString("uniqueId"); if (uniqueIdString == null) { throw new ArgumentException("uniqueId not present in message"); } var timeSeriesField = (FudgeMsg)message.GetMessage("timeSeries"); if (timeSeriesField == null) { throw new ArgumentException("timeSeries not present in message"); } return Tuple.Create(UniqueId.Parse(uniqueIdString), _fudgeContext.GetSerializer().Deserialize<ILocalDateDoubleTimeSeries>(timeSeriesField)); }