Exemple #1
0
        public void TestCompare2()
        {
            MockTradeActivityItem ta1 = new MockTradeActivityItem("MTM", DateTime.Today, 1, 200, 3, JobStatus.Queued);
            MockTradeActivityItem ta2 = new MockTradeActivityItem("MTM", DateTime.Today, 1, 100, 3, JobStatus.Queued);

            jc = UnitTestHelper.GetJobComparerInstance(new MockPrioritizer());

            Assert.IsTrue(jc.Compare(ta1, ta2) > 0, "Wrong Compare method implementation.");
        }
Exemple #2
0
            /// <summary>
            /// <para>Compares two <see cref="ITradeActivityItem"/> instances</para>
            /// <para>Compares jobs using prioritizer. If they are same, then compares them as per their QueueIds.
            /// </para>
            /// </summary>
            /// <param name="job">job to compare</param>
            /// <param name="otherJob">other job to compare</param>
            /// <returns>
            /// negative number if job is less than otherJob,
            /// zero if they are equal,
            /// positive number if job is greater than otherJob
            /// </returns>
            public int Compare(ITradeActivityItem job, ITradeActivityItem otherJob)
            {
                //Use prioritizer to compare first
                int comp = prioritizer.Compare(job, otherJob);

                if (comp != 0)
                {
                    return(comp);
                }

                //Comapre the queueIds
                return(job.QueueID.CompareTo(otherJob.QueueID));
            }