public ApplicationController(IEnvironmentService environmentService, IPresentationService presentationService, ShellService shellService, Lazy<FileController> fileController, Lazy<RichTextDocumentController> richTextDocumentController, Lazy<PrintController> printController, Lazy<ShellViewModel> shellViewModel, Lazy<MainViewModel> mainViewModel, Lazy<StartViewModel> startViewModel) { // Upgrade the settings from a previous version when the new version starts the first time. if (Settings.Default.IsUpgradeNeeded) { Settings.Default.Upgrade(); Settings.Default.IsUpgradeNeeded = false; } // Initializing the cultures must be done first. Therefore, we inject the Controllers and ViewModels lazy. InitializeCultures(); presentationService.InitializeCultures(); this.environmentService = environmentService; this.fileController = fileController.Value; this.richTextDocumentController = richTextDocumentController.Value; this.printController = printController.Value; this.shellViewModel = shellViewModel.Value; this.mainViewModel = mainViewModel.Value; this.startViewModel = startViewModel.Value; shellService.ShellView = this.shellViewModel.View; this.shellViewModel.Closing += ShellViewModelClosing; this.exitCommand = new DelegateCommand(Close); }
public void ExecutePrintCommand() { MockPrintPreviewView printPreviewView = new MockPrintPreviewView(); ShellService shellService = new ShellService(); MockDocumentPaginatorSource document = new MockDocumentPaginatorSource(); PrintPreviewViewModel printPreviewViewModel = new PrintPreviewViewModel(printPreviewView, shellService, document); Assert.AreEqual(document, printPreviewViewModel.Document); printPreviewViewModel.PrintCommand.Execute(null); Assert.IsTrue(printPreviewView.PrintCalled); }
public void ZoomTest() { ShellService shellService = new ShellService(); Assert.AreEqual(1d, shellService.Zoom); shellService.Zoom = 0.75; Assert.AreEqual(0.75, shellService.Zoom); shellService.Zoom = 0.1; Assert.AreEqual(0.25, shellService.Zoom); shellService.Zoom = 25; Assert.AreEqual(16, shellService.Zoom); }
public void DefaultZoomsTest() { ShellService shellService = new ShellService(); shellService.DefaultZooms.SequenceEqual(new[] { "200%", "150%", "125%", "100%", "75%", "50%", "25%" }); }