public RedirectToRouteResult BanUser(BanUserViewModel model)
 {
     TimeSpan duration = new TimeSpan();
     if (model.BanDuration != "Permanent")
     {
         duration = TimeSpan.Parse(model.BanDuration);
     }
     _userService.BanUser(model.UserId, duration);
     return RedirectToAction("GetAllGames",  "Games");
 }
        public void Test_BanUser_Call_BanUser_With_Right_TimeSpan_Param()
        {
            //arrange
            UsersController controller = new UsersController(_userService.Object);
            BanUserViewModel model = new BanUserViewModel()
            {
                UserId = 1,
                BanDuration = "1:00:00"
            };

            //act
            controller.BanUser(model);

            //assert
            _userService.Verify(u => u.BanUser(It.IsAny<int>(), It.Is<TimeSpan>( t => t.Hours == 1 )), Times.Once());
        }
 public ViewResult BanUser(int id)
 {
     BanUserViewModel model = new BanUserViewModel() { UserId = id };
     return View(model);
 }