public ListaAvisosPage(AvisoController _avisos) { InitializeComponent(); avisos = _avisos; paginavisos.ItemsSource = avisos.ListaAvisos; //adiciona os objetos à listview }
public AvisoControllerTest() { //In order to use a mock implementation of a Unit Of work you must // first create a mock representation of it and pass it Object instance to where it needs to be used var mockRepository = new Mock <IAvisoRepositorio>(); var mockUoW = new Mock <IUnitOfWork>(); mockUoW.SetupGet(a => a.Avisos).Returns(mockRepository.Object); _avisoController = new AvisoController(mockUoW.Object); }
public AvisosPage() { InitializeComponent(); avisos = new AvisoController(); //ADICIONA OS OBJECTOS A LISTVIEW lavisos.ItemsSource = avisos.ListaAvisos; //LISTA NÃO PODE SER SELECIONADA lavisos.ItemSelected += (sender, e) => { ((ListView)sender).SelectedItem = null; }; }
public void Selecionar_Aviso_Com_Sucesso() { var context = _ContextoFake.GerarContexto("InlcuirAviso_Sucesso"); context = ContextFakeSeeds.SeedAviso(context); var repo = new AvisoRepositorio(context); var services = new AvisoAplicacao(repo, _mapper); var controller = new AvisoController(services); controller.ControllerContext.HttpContext = new DefaultHttpContext(); controller.ControllerContext .HttpContext .User = FakeUserClaims.GerarUsuarioPadraoParaContexto(); var result = controller.Get(); Assert.IsType <ActionResult <IEnumerable <AvisoViewModel> > >(result); var res = Assert.IsType <OkObjectResult>(result.Result); Assert.IsType <List <AvisoViewModel> >(res.Value); }