public void TestRequiresOrigSendingTime_N() { // Under OrigSendingTime=N, session will allow ResendRequest that lacks OrigSendingTime session.RequiresOrigSendingTime = false; Logon(); QuickFix.FIX42.SequenceReset sr = new QuickFix.FIX42.SequenceReset(new QuickFix.Fields.NewSeqNo(5)); sr.GapFillFlag = new QuickFix.Fields.GapFillFlag(true); sr.Header.SetField(new QuickFix.Fields.PossDupFlag(true)); sr.Header.SetField(new QuickFix.Fields.MsgSeqNum(seqNum--)); // so it triggers DoTargetTooLow code SendTheMessage(sr); Assert.False(responder.msgLookup.ContainsKey(QuickFix.Fields.MsgType.REJECT)); }
public void TestRequiresOrigSendingTime_Y() { // Under default configuration, session should reject a ResendRequest that lacks OrigSendingTime unset // Check default is as expected Assert.That(session.RequiresOrigSendingTime, Is.EqualTo(true)); Logon(); QuickFix.FIX42.SequenceReset sr = new QuickFix.FIX42.SequenceReset(new QuickFix.Fields.NewSeqNo(5)); sr.GapFillFlag = new QuickFix.Fields.GapFillFlag(true); sr.Header.SetField(new QuickFix.Fields.PossDupFlag(true)); sr.Header.SetField(new QuickFix.Fields.MsgSeqNum(seqNum--)); // so it triggers DoTargetTooLow code SendTheMessage(sr); Assert.That(responder.msgLookup[QuickFix.Fields.MsgType.REJECT].Count == 1); QuickFix.FIX42.Reject rej = responder.msgLookup[QuickFix.Fields.MsgType.REJECT].Peek() as QuickFix.FIX42.Reject; Assert.That(rej.SessionRejectReason.getValue(), Is.EqualTo(QuickFix.Fields.SessionRejectReason.REQUIRED_TAG_MISSING)); }
public void TestMaxMessagesInResendRequest() { // Default Assert.That(session.MaxMessagesInResendRequest, Is.EqualTo(0)); session.MaxMessagesInResendRequest = 2500; // Logon Logon(); // NOS QuickFix.FIX42.NewOrderSingle order = new QuickFix.FIX42.NewOrderSingle( new QuickFix.Fields.ClOrdID("1"), new QuickFix.Fields.HandlInst(QuickFix.Fields.HandlInst.MANUAL_ORDER), new QuickFix.Fields.Symbol("IBM"), new QuickFix.Fields.Side(QuickFix.Fields.Side.BUY), new QuickFix.Fields.TransactTime(), new QuickFix.Fields.OrdType(QuickFix.Fields.OrdType.LIMIT)); order.Header.SetField(new QuickFix.Fields.TargetCompID(sessionID.SenderCompID)); order.Header.SetField(new QuickFix.Fields.SenderCompID(sessionID.TargetCompID)); order.Header.SetField(new QuickFix.Fields.MsgSeqNum(5005)); // This will generate resend requests session.Verify(order, true, false); // 3 resend requests // 2->2501 // 2502->5001 // 5002->5005 Assert.That(responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Count == 1); QuickFix.Message msg = responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Dequeue(); Assert.That(msg.GetInt(QuickFix.Fields.Tags.BeginSeqNo), Is.EqualTo(2)); Assert.That(msg.GetInt(QuickFix.Fields.Tags.EndSeqNo), Is.EqualTo(2501)); // Jump forward to the end of the resend chunk with a fillgap reset message QuickFix.FIX42.SequenceReset reset = new QuickFix.FIX42.SequenceReset(); reset.Header.SetField(new QuickFix.Fields.TargetCompID(sessionID.SenderCompID)); reset.Header.SetField(new QuickFix.Fields.SenderCompID(sessionID.TargetCompID)); reset.SetField(new QuickFix.Fields.GapFillFlag(true)); reset.Header.SetField(new QuickFix.Fields.MsgSeqNum(2)); reset.SetField(new QuickFix.Fields.NewSeqNo(2501)); session.Next(reset); order.Header.SetField(new QuickFix.Fields.MsgSeqNum(2501)); session.Next(order); // Should have triggered next resend (2502->5001), check this Console.WriteLine(responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Count); Assert.That(responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Count == 1); msg = responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Dequeue(); Assert.That(msg.GetInt(QuickFix.Fields.Tags.BeginSeqNo), Is.EqualTo(2502)); Assert.That(msg.GetInt(QuickFix.Fields.Tags.EndSeqNo), Is.EqualTo(5001)); // Jump forward to the end of the resend chunk with a fillgap reset message reset.Header.SetField(new QuickFix.Fields.MsgSeqNum(2502)); reset.SetField(new QuickFix.Fields.NewSeqNo(5001)); session.Next(reset); order.Header.SetField(new QuickFix.Fields.MsgSeqNum(5001)); session.Next(order); // Triggers next resend (5002->5005) Console.WriteLine(responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Count); Assert.That(responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Count == 1); msg = responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Dequeue(); Assert.That(msg.GetInt(QuickFix.Fields.Tags.BeginSeqNo), Is.EqualTo(5002)); Assert.That(msg.GetInt(QuickFix.Fields.Tags.EndSeqNo), Is.EqualTo(5004)); }
public void TestMaxMessagesInResendRequest() { // Default Assert.That(session.MaxMessagesInResendRequest, Is.EqualTo(0)); session.MaxMessagesInResendRequest = 2500; // Logon Logon(); // NOS QuickFix.FIX42.NewOrderSingle order = new QuickFix.FIX42.NewOrderSingle( new QuickFix.Fields.ClOrdID("1"), new QuickFix.Fields.HandlInst(QuickFix.Fields.HandlInst.MANUAL_ORDER), new QuickFix.Fields.Symbol("IBM"), new QuickFix.Fields.Side(QuickFix.Fields.Side.BUY), new QuickFix.Fields.TransactTime(), new QuickFix.Fields.OrdType(QuickFix.Fields.OrdType.LIMIT)); order.Header.SetField(new QuickFix.Fields.TargetCompID(sessionID.SenderCompID)); order.Header.SetField(new QuickFix.Fields.SenderCompID(sessionID.TargetCompID)); order.Header.SetField(new QuickFix.Fields.MsgSeqNum(5005)); // This will generate resend requests session.Verify(order, true, false); // 3 resend requests // 2->2501 // 2502->5001 // 5002->5005 Assert.That(responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Count == 1); QuickFix.Message msg = responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Dequeue(); Assert.That(msg.GetInt(QuickFix.Fields.Tags.BeginSeqNo), Is.EqualTo(2)); Assert.That(msg.GetInt(QuickFix.Fields.Tags.EndSeqNo), Is.EqualTo(2501)); // Jump forward to the end of the resend chunk with a fillgap reset message QuickFix.FIX42.SequenceReset reset = new QuickFix.FIX42.SequenceReset(); reset.Header.SetField(new QuickFix.Fields.TargetCompID(sessionID.SenderCompID)); reset.Header.SetField(new QuickFix.Fields.SenderCompID(sessionID.TargetCompID)); reset.SetField(new QuickFix.Fields.GapFillFlag(true)); reset.Header.SetField(new QuickFix.Fields.MsgSeqNum(2)); reset.SetField(new QuickFix.Fields.NewSeqNo(2501)); session.Next(reset.ToString()); order.Header.SetField(new QuickFix.Fields.MsgSeqNum(2501)); session.Next(order.ToString()); // Should have triggered next resend (2502->5001), check this Console.WriteLine(responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Count); Assert.That(responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Count == 1); msg = responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Dequeue(); Assert.That(msg.GetInt(QuickFix.Fields.Tags.BeginSeqNo), Is.EqualTo(2502)); Assert.That(msg.GetInt(QuickFix.Fields.Tags.EndSeqNo), Is.EqualTo(5001)); // Jump forward to the end of the resend chunk with a fillgap reset message reset.Header.SetField(new QuickFix.Fields.MsgSeqNum(2502)); reset.SetField(new QuickFix.Fields.NewSeqNo(5001)); session.Next(reset.ToString()); order.Header.SetField(new QuickFix.Fields.MsgSeqNum(5001)); session.Next(order.ToString()); // Triggers next resend (5002->5005) Console.WriteLine(responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Count); Assert.That(responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Count == 1); msg = responder.msgLookup[QuickFix.Fields.MsgType.RESENDREQUEST].Dequeue(); Assert.That(msg.GetInt(QuickFix.Fields.Tags.BeginSeqNo), Is.EqualTo(5002)); Assert.That(msg.GetInt(QuickFix.Fields.Tags.EndSeqNo), Is.EqualTo(5004)); }