Esempio n. 1
0
        public DocumentsWindowViewModelUnitTest()
        {
            documents = new List <Document>();
            documents.Add(new Document()
            {
                Id = 1, Title = "Document 1"
            });
            documents.Add(new Document()
            {
                Id = 2, Title = "Document 2"
            });

            mockDocumentService = new Mock <IDocumentService>();
            mockDocumentService.Setup(ds => ds.GetDocuments()).Returns(Task.FromResult <IEnumerable <Document> >(documents));

            mockDocumentVersonService = new Mock <IDocumentVersionService>();

            stubFileHelper = new Mock <IFileHelper>();

            stubWindowHelper = new Mock <IWindowHelper>();

            mapper = new MapperConfiguration(c => c.AddProfile <MappingProfile>()).CreateMapper();

            documentsWindowViewModel = new DocumentsWindowViewModel(mockDocumentService.Object, mockDocumentVersonService.Object, stubFileHelper.Object, stubWindowHelper.Object, mapper);
        }
Esempio n. 2
0
        public DocumentsWindow()
        {
            InitializeComponent();

            var documentService        = (Application.Current as App).DocumentService;
            var documentVersionService = (Application.Current as App).DocumentVersionService;
            var fileHelper             = (Application.Current as App).FileHelper;
            var windowHelper           = (Application.Current as App).WindowHelper;
            var mapper = (Application.Current as App).Mapper;

            ViewModel = new DocumentsWindowViewModel(documentService, documentVersionService, fileHelper, windowHelper, mapper);
        }