public ProdutoEditViewModelTeste()
        {
            _arquivoServiceMock = new Mock <IArquivoService>();
            _arquivoServiceMock.SetupAllProperties();

            _dialogServiceMock = new Mock <IDialogService>();
            _dialogServiceMock.SetupAllProperties();
            _dialogServiceMock
            .Setup(f => f.BuscaCamimhoImagem(It.IsAny <Action <string, byte[]> >()))
            .Callback <Action <string, byte[]> >(c => c.Invoke("teste.jpg", new byte[] { }));
            _dialogServiceMock.Setup(f => f.Confirmacao(It.IsAny <string>(), It.IsAny <Action>(), "Atenção"))
            .Callback <string, Action, string>((mensagem, acao, titulo) => acao.Invoke());

            _repo = new Mock <IProdutoRepository>();
            _repo.SetupAllProperties();
            _repo.Setup(f => f.IncluirAsync(It.IsAny <Produto>()))
            .ReturnsAsync(new Resultado());

            _navigationService = new Mock <INavigationService>();
            _navigationService.SetupAllProperties();
            _navigationService.Setup(f => f.Navigate(It.IsAny <string>(), It.IsAny <object>()));

            _viewModel = new ProdutoEditPageViewModel(
                _dialogServiceMock.Object,
                _arquivoServiceMock.Object,
                _repo.Object,
                _navigationService.Object
                );
        }
Пример #2
0
        public ProdutoEditPage()
        {
            InitializeComponent();

            ViewModel = DataContext as ProdutoEditPageViewModel;

            _expanders = new[]
            {
                ExpanderPrincipal,
                ExpanderImagens,
                ExpanderEspecificacoes
            };
            ExpanderPrincipal.Expanded      += ExpanderExpanded;
            ExpanderImagens.Expanded        += ExpanderExpanded;
            ExpanderEspecificacoes.Expanded += ExpanderExpanded;
        }