示例#1
0
        public ModuleController(IMessageService messageService, IPresentationService presentationService, 
            IEntityController entityController, BookController bookController, PersonController personController, 
            ShellService shellService, Lazy<ShellViewModel> shellViewModel)
        {
            presentationService.InitializeCultures();

            this.messageService = messageService;
            this.entityController = entityController;
            this.bookController = bookController;
            this.personController = personController;
            this.shellService = shellService;
            this.shellViewModel = shellViewModel;
            this.exitCommand = new DelegateCommand(Close);
        }
示例#2
0
        public void SetViewTest()
        {
            ShellService shellService = new ShellService();
            object mockView = new object();

            AssertHelper.PropertyChangedEvent(shellService, x => x.ShellView, () =>
                shellService.ShellView = mockView);
            Assert.AreEqual(mockView, shellService.ShellView);
            
            AssertHelper.PropertyChangedEvent(shellService, x => x.BookListView, () =>
                shellService.BookListView = mockView);
            Assert.AreEqual(mockView, shellService.BookListView);

            AssertHelper.PropertyChangedEvent(shellService, x => x.BookView, () =>
                shellService.BookView = mockView);
            Assert.AreEqual(mockView, shellService.BookView);

            AssertHelper.PropertyChangedEvent(shellService, x => x.PersonListView, () =>
                shellService.PersonListView = mockView);
            Assert.AreEqual(mockView, shellService.PersonListView);

            AssertHelper.PropertyChangedEvent(shellService, x => x.PersonView, () =>
                shellService.PersonView = mockView);
            Assert.AreEqual(mockView, shellService.PersonView);

            bool isReportingEnabled = true;
            Lazy<object> lazyReportingView = new Lazy<object>(() => null);
            
            AssertHelper.PropertyChangedEvent(shellService, x => x.IsReportingEnabled, () =>
                shellService.IsReportingEnabled = isReportingEnabled);
            Assert.AreEqual(isReportingEnabled, shellService.IsReportingEnabled);

            AssertHelper.PropertyChangedEvent(shellService, x => x.LazyReportingView, () =>
                shellService.LazyReportingView = lazyReportingView);
            Assert.AreEqual(lazyReportingView, shellService.LazyReportingView);
        }