public void DifferentSportsSort()
        {
            SortableObservableCollection <IMatchVw> collection = new SortableObservableCollection <IMatchVw>();

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.NotStarted, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test1", SportDescriptor = "SPRT_SOCCER", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 1 }
                    }
                }, StartDate = new DateTime(2013, 1, 1), DefaultSorting = 1
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test2", SportDescriptor = "SPRT_TENNIS", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 1), DefaultSorting = 2
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test3", SportDescriptor = "SPRT_TENNIS", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 2), DefaultSorting = 2
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Stopped, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test4", SportDescriptor = "SPRT_TENNIS", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 1), DefaultSorting = 2
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Stopped, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test5", SportDescriptor = "SPRT_SOCCER", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 1 }
                    }
                }, StartDate = new DateTime(2013, 1, 2), DefaultSorting = 1
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = false, LiveBetStatus = eMatchStatus.Undefined, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test6", SportDescriptor = "SPRT_SOCCER", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 1 }
                    }
                }, StartDate = new DateTime(2013, 1, 2), DefaultSorting = 1
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.NotStarted, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test7", SportDescriptor = "SPRT_TENNIS", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 3), DefaultSorting = 2
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Stopped, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test8", SportDescriptor = "SPRT_SOCCER", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 1 }
                    }
                }, StartDate = new DateTime(2013, 1, 1), DefaultSorting = 1
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = false, LiveBetStatus = eMatchStatus.Undefined, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test9", SportDescriptor = "SPRT_SOCCER", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 1 }
                    }
                }, StartDate = new DateTime(2013, 1, 4), DefaultSorting = 1
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Stopped, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test10", SportDescriptor = "SPRT_TENNIS", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 2), DefaultSorting = 2
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = false, LiveBetStatus = eMatchStatus.Undefined, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test11", SportDescriptor = "SPRT_TENNIS", SportView = new TestGroupVw()
                {
                    DisplayName = "t", LineObject = new GroupLn()
                    {
                        Sort = { Value = 2 }
                    }
                }, StartDate = new DateTime(2013, 1, 5), DefaultSorting = 2
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test12", SportDescriptor = "SPRT_SOCCER", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 1 }
                    }
                }, StartDate = new DateTime(2013, 1, 1), DefaultSorting = 1
            });

            collection.Add(new TestMatchVw()
            {
                IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinuteEx = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test13", SportDescriptor = "SPRT_SOCCER", SportView = new TestGroupVw()
                {
                    DisplayName = "s", LineObject = new GroupLn()
                    {
                        Sort = { Value = 1 }
                    }
                }, StartDate = new DateTime(2013, 1, 2), DefaultSorting = 1
            });

            var groupln = new GroupLn {
                Sort = { Value = 1 }
            };

            collection.Sort(LiveMonitorsService.Comparison);
            LiveMonitorsService.UpdateHeaders(collection);

            Assert.AreEqual("test12", collection[0].Name);  //s
            Assert.AreEqual("test8", collection[1].Name);   //s
            Assert.AreEqual("test13", collection[2].Name);  //s
            Assert.AreEqual("test5", collection[3].Name);   //s
            Assert.AreEqual("test2", collection[4].Name);   //t
            Assert.AreEqual("test4", collection[5].Name);   //t
            Assert.AreEqual("test10", collection[6].Name);  //t
            Assert.AreEqual("test3", collection[7].Name);   //t
            Assert.AreEqual("test1", collection[8].Name);   //s
            Assert.AreEqual("test6", collection[9].Name);   //s
            Assert.AreEqual("test9", collection[10].Name);  //s
            Assert.AreEqual("test7", collection[11].Name);  //t
            Assert.AreEqual("test11", collection[12].Name); //t

            Assert.AreEqual(true, collection[0].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[1].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[2].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[3].IsHeaderForLiveMonitor);
            Assert.AreEqual(true, collection[4].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[5].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[6].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[7].IsHeaderForLiveMonitor);
            Assert.AreEqual(true, collection[8].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[9].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[10].IsHeaderForLiveMonitor);
            Assert.AreEqual(true, collection[11].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[12].IsHeaderForLiveMonitor);

            collection = new SortableObservableCollection <IMatchVw>(collection.OrderByDescending(x => x.Name).ToList());

            collection.Sort(LiveMonitorsService.Comparison);
            LiveMonitorsService.UpdateHeaders(collection);

            Assert.AreEqual("test12", collection[0].Name);  //s
            Assert.AreEqual("test8", collection[1].Name);   //s
            Assert.AreEqual("test13", collection[2].Name);  //s
            Assert.AreEqual("test5", collection[3].Name);   //s
            Assert.AreEqual("test2", collection[4].Name);   //t
            Assert.AreEqual("test4", collection[5].Name);   //t
            Assert.AreEqual("test10", collection[6].Name);  //t
            Assert.AreEqual("test3", collection[7].Name);   //t
            Assert.AreEqual("test1", collection[8].Name);   //s
            Assert.AreEqual("test6", collection[9].Name);   //s
            Assert.AreEqual("test9", collection[10].Name);  //s
            Assert.AreEqual("test7", collection[11].Name);  //t
            Assert.AreEqual("test11", collection[12].Name); //t

            Assert.AreEqual(true, collection[0].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[1].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[2].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[3].IsHeaderForLiveMonitor);
            Assert.AreEqual(true, collection[4].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[5].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[6].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[7].IsHeaderForLiveMonitor);
            Assert.AreEqual(true, collection[8].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[9].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[10].IsHeaderForLiveMonitor);
            Assert.AreEqual(true, collection[11].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[12].IsHeaderForLiveMonitor);
        }
        public void SameSport()
        {
            SortableObservableCollection <IMatchVw> collection = new SortableObservableCollection <IMatchVw>();

            collection.Add(new TestMatchVw()
            {
                SportDescriptor = "SPRT_SOCCER", IsLiveBet = false, LiveBetStatus = eMatchStatus.Undefined, LiveMatchMinute = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test1", SportView = new TestGroupVw()
                {
                    DisplayName = "s"
                }, StartDate = new DateTime(2013, 1, 5)
            });

            collection.Add(new TestMatchVw()
            {
                SportDescriptor = "SPRT_SOCCER", IsLiveBet = true, LiveBetStatus = eMatchStatus.Started, LiveMatchMinute = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test2", SportView = new TestGroupVw()
                {
                    DisplayName = "s"
                }, StartDate = new DateTime(2013, 1, 2)
            });

            collection.Add(new TestMatchVw()
            {
                SportDescriptor = "SPRT_SOCCER", IsLiveBet = false, LiveBetStatus = eMatchStatus.Undefined, LiveMatchMinute = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test3", SportView = new TestGroupVw()
                {
                    DisplayName = "s"
                }, StartDate = new DateTime(2013, 1, 3)
            });

            collection.Add(new TestMatchVw()
            {
                SportDescriptor = "SPRT_SOCCER", IsLiveBet = true, LiveBetStatus = eMatchStatus.Stopped, LiveMatchMinute = 1, LivePeriodInfo = eLivePeriodInfo.Basketball_1st_Quarter, Name = "test4", SportView = new TestGroupVw()
                {
                    DisplayName = "s"
                }, StartDate = new DateTime(2013, 1, 4)
            });


            collection.Sort(LiveMonitorsService.Comparison);
            LiveMonitorsService.UpdateHeaders(collection);

            Assert.AreEqual("test2", collection[0].Name); //s
            Assert.AreEqual("test4", collection[1].Name); //s
            Assert.AreEqual("test3", collection[2].Name); //s
            Assert.AreEqual("test1", collection[3].Name); //s


            Assert.AreEqual(true, collection[0].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[1].IsHeaderForLiveMonitor);
            Assert.AreEqual(true, collection[2].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[3].IsHeaderForLiveMonitor);


            collection = new SortableObservableCollection <IMatchVw>(collection.OrderByDescending(x => x.Name).ToList());

            collection.Sort(LiveMonitorsService.Comparison);
            LiveMonitorsService.UpdateHeaders(collection);

            Assert.AreEqual("test2", collection[0].Name); //s
            Assert.AreEqual("test4", collection[1].Name); //s
            Assert.AreEqual("test3", collection[2].Name); //s
            Assert.AreEqual("test1", collection[3].Name); //s

            Assert.AreEqual(true, collection[0].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[1].IsHeaderForLiveMonitor);
            Assert.AreEqual(true, collection[2].IsHeaderForLiveMonitor);
            Assert.AreEqual(false, collection[3].IsHeaderForLiveMonitor);
        }