示例#1
0
	    public GraphSettingsController(GraphSettings graphSettingsViewModel,
            GraphController graphController,
            Configuration configuration,
            IDownloadStringService downloadStringService,
            IPersistDomainModels<Configuration> configRepository)
		{
	        Guard.Requires<ArgumentNullException>(graphSettingsViewModel != null);
            Guard.Requires<ArgumentNullException>(graphController != null);
            Guard.Requires<ArgumentNullException>(configuration != null);
            Guard.Requires<ArgumentNullException>(downloadStringService != null);
            Guard.Requires<ArgumentNullException>(configRepository != null);

            this.graphController = graphController;
            GraphSettingsViewModel = graphSettingsViewModel;
	        GraphSettingsViewModel.Graph = GraphViewModel;
            GraphSettingsViewModel.PropertyChanged += ViewModel_PropertyChanged;
            GraphSettingsViewModel.Save.AfterExecute += ViewModel_Save_AfterExecute;
            GraphSettingsViewModel.Test.AfterExecute += ViewModel_Test_AfterExecute;
            graphSettingsViewModel.Cancel.AfterExecute += ViewModel_Cancel_AfterExecute;
            this.downloadStringService = downloadStringService;
            this.configRepository = configRepository;
            graphConfig = new GraphConfig(configuration);
            backupConfig = new GraphConfig(configuration.Clone() as Configuration);

		    DownloadAndLoadDataIntoViewModel();
		}
            public void Setup()
            {
                graphSettingsViewModel = new GraphSettings();
                downloadStringServiceFake = new Mock<IDownloadStringService>();
                configRepositoryFake = new Mock<IPersistDomainModels<Configuration>>();
                configuration = GraphConfig.NewDefaultConfiguration();
                graphController = new Mock<GraphController>(
                    new Graph(), 
                    downloadStringServiceFake.Object,
                    new Mock<ITimer>().Object,
                    configuration,
                    new Mock<IProgressbar>().Object);

                Before();
            }