Exemplo n.º 1
0
        public void GetGameFilterByDateTestsSearchDateBeforeStartDateReturnsError()
        {
            var modelUtils = new ModelUtilities();
            var initializer = new ModelDataInitializer();
            List<GameFilter> gameFilters = initializer.InitializeGameFilters();

            var actual = modelUtils.GetGameFilterByDate(gameFilters, new DateTime(2011, 07, 4));
            Assert.AreEqual(null, actual);
        }
Exemplo n.º 2
0
        public void GetGameFilterByDateTestsSearchDateEqualsEndDateReturnsCorrect()
        {
            var modelUtils = new ModelUtilities();
            var initializer = new ModelDataInitializer();
            List<GameFilter> gameFilters = initializer.InitializeGameFilters();

            var actual = modelUtils.GetGameFilterByDate(gameFilters, new DateTime(2012, 09, 24, 23, 59, 59));
            Assert.AreEqual("Week 03", actual.GameFilterName);
        }
        public ActionResult Index()
        {
            var utilities = new ModelUtilities();
            var now = DateTime.Now;
            //var now = new DateTime(2012, 12, 16);
            string viewBagMessageToUser = string.Empty;

            try
            {
                var currentGameFilterId = utilities.GetGameFilterByDate(db.GameFilters.ToList(), now).GameFilterId;
                return RedirectToAction(string.Concat("GameFilter/", currentGameFilterId));
            }
            catch (Exception ex)
            {
                ViewBag.MessageToUser = string.Format("Sorry an error occurred. Please let the admin know. Error:{0}", ex.Message);
                SetViewBagGameFilterToFirst();
                return View();
            }
        }