public void Create() { VotarController controller = new VotarController(GetService <IUsuarioServices>(), GetService <IVotacaoServices>(), GetService <IRestauranteServices>()); ViewResult result = controller.Create() as ViewResult; Assert.IsNotNull(result); }
public void GetUsuariosCreate() { VotarController controller = new VotarController(GetService <IUsuarioServices>(), GetService <IVotacaoServices>(), GetService <IRestauranteServices>()); ViewResult result = controller.Create() as ViewResult; var votarVm = (VotarViewModel)result.Model; Assert.IsTrue(votarVm.UsuariosViewModel.Usuarios.Any()); }
public void VotarCreate() { VotarController controller = new VotarController(GetService <IUsuarioServices>(), GetService <IVotacaoServices>(), GetService <IRestauranteServices>()); var votoVm = new VotarViewModel() { IdRestaurante = 1, IdUsuario = 1 }; ViewResult result = controller.Create(votoVm) as ViewResult; var error = (bool)result.ViewData["Error"]; if (DateTime.Now.TimeOfDay > TimeSpan.Parse("12:00")) { Assert.IsFalse(error); } else { Assert.IsTrue(error); } }