示例#1
0
        public void Controller_GetChannelsWithFilter_Parameter_Default()
        {
            controller = Controller.GetInstance();

            ChannelSearchArgs csa = controller.GetDefaultChannelSearchArgs();

            try
            {
                controller.GetChannels(csa);
            }
            catch
            {
                Assert.Fail("An exception was raised");
            }
        }
示例#2
0
 public void Controller_GetChannelsWithFilter_State_SortHitsAscending()
 {
     controller = Controller.GetInstance();
     ChannelSearchArgs csa = controller.GetDefaultChannelSearchArgs();
     csa.SortOption = csa.HitsAsc;
     try
     {
         CreateChannelsForTests();
         IEnumerable<RentItServer.ITU.DatabaseWrapperObjects.Channel> channels = controller.GetChannels(csa);
         List<RentItServer.ITU.DatabaseWrapperObjects.Channel> theChannels = new List<RentItServer.ITU.DatabaseWrapperObjects.Channel>(channels);
         Assert.IsTrue(theChannels.Count >= interval);
         for (int i = 1; i < theChannels.Count; i++)
         {   // The previous should be less then current
             Assert.IsTrue(theChannels[i - 1].Hits <= theChannels[i].Hits);
         }
     }
     catch (Exception e)
     {
         Assert.Fail("An exception was raised. " + e);
     }
 }
示例#3
0
 public void Controller_GetChannelsWithFilter_State_SortNumberOfCommentsDescending()
 {
     controller = Controller.GetInstance();
     ChannelSearchArgs csa = controller.GetDefaultChannelSearchArgs();
     csa.SortOption = csa.NumberOfCommentsDesc;
     try
     {
         CreateChannelsForTests();
         IEnumerable<RentItServer.ITU.DatabaseWrapperObjects.Channel> channels = controller.GetChannels(csa);
         List<RentItServer.ITU.DatabaseWrapperObjects.Channel> theChannels = new List<RentItServer.ITU.DatabaseWrapperObjects.Channel>(channels);
         Assert.IsTrue(theChannels.Count >= interval);
         for (int i = 1; i < theChannels.Count; i++)
         {   // The previous should be larger then current
             Assert.IsTrue(_dao.GetChannelComments(theChannels[i - 1].Id, 0, int.MaxValue).Count >= _dao.GetChannelComments(theChannels[i].Id, 0, int.MaxValue).Count);
         }
     }
     catch
     {
         Assert.Fail("An exception was raised");
     }
 }