Exemplo n.º 1
0
        public TestMethodListViewModel(
            TestProjectsViewModel testProjectsViewModel,
            ITestResultsRepository testResultsRepository,
            ITestMethodRepository testMethodsRepository,
            IEventAggregator eventAggregator,
            IExecutor <TestCaseInfo> executor,
            IConfigurationManager configClass)
        {
            this.testProjectsViewModel = testProjectsViewModel;
            this.testResultsRepository = testResultsRepository;
            this.testMethodsRepository = testMethodsRepository;
            this.eventAggregator       = eventAggregator;
            this.executor    = executor;
            this.configClass = configClass;

            this.executor.Initialize(RealTimeEvent);

            this.QueryTestMethodsCommand         = new DelegateCommand(OnQueryTestMethods, CanQueryTestMethods);
            this.DeleteTestMethodsCommand        = new DelegateCommand(OnDeleteTestMethods, CanDeleteTestMethods);
            this.DiscoverTestMethodsCommand      = new DelegateCommand <List <string> >(OnDiscoverTestMethods, (x) => this.canDiscoverTestMethods);
            this.SaveTestMethodsCommand          = new DelegateCommand(OnSaveTestMethods, CanSaveTestMethods);
            this.RunTestMethodsCommand           = new DelegateCommand(OnRunTestMethods, CanRunTestMethods);
            this.CancelTestRunCommand            = new DelegateCommand(OnCancelTestRun, CanCancelTestRun);
            this.AddTestMethodsToProjectCommand  = new DelegateCommand <TestProjectInfo>(OnAddTestMethodsToProject, (x) => true);
            this.TestMethodsSelectChangedCommand = new DelegateCommand(OnTestMethodsSelectChanged, () => true);

            this.eventAggregator.GetEvent <TestProjectUpdatedEvent>().Subscribe(TestCaseInfoListShow);
            this.testProjectsViewModel.TestProjectsChanged += TestProjectsViewModel_TestProjectsChanged;
            this.testProjects.Add(this.testRespository);
        }
Exemplo n.º 2
0
        private void RegisterDIContainer()
        {
            ServiceCollection services = new ServiceCollection();

            services.AddTransient <TestMethodListViewModel>();

            services.AddSingleton <RealTimeInfoViewModel>();
            services.AddSingleton <TestMethodViewModel>();
            services.AddSingleton <TestProjectsViewModel>();
            services.AddSingleton <TestResultViewModel>();
            services.AddSingleton <ConfigurationViewMode>();

            services.AddSingleton <ITestMethodRepository, TestMethodInfoRepository>();
            services.AddSingleton <ITestResultsRepository, TestResultsRepository>();
            services.AddSingleton <IEventAggregator, EventAggregator>();
            services.AddSingleton <IExecutor <TestCaseInfo>, Executor>();
            services.AddSingleton <IConfigurationManager, ConfigClass>();

            services.AddSingleton <IDialogService <object>, DialogService>();

            this.Container = services.BuildServiceProvider();

            IConfigurationManager configurationManager = this.Container.GetService <IConfigurationManager>();
            ITestMethodRepository testMethodRepository = this.Container.GetService <ITestMethodRepository>();

            testMethodRepository.SetConfigurationManager(configurationManager);
            ITestResultsRepository testResultsRepository = this.Container.GetService <ITestResultsRepository>();

            testResultsRepository.SetConfigurationManager(configurationManager);
            IExecutor <TestCaseInfo> executor = this.Container.GetService <IExecutor <TestCaseInfo> >();

            executor.SetConfigurationManager(configurationManager);
        }
Exemplo n.º 3
0
        public TestMethodViewModel(
            ITestMethodRepository testMethodsRepository,
            IEventAggregator eventAggregator)
        {
            this.testMethodsRepository = testMethodsRepository;
            this.eventAggregator       = eventAggregator;

            this.eventAggregator.GetEvent <TestMethodSelectedEvent>().Subscribe(SetTestMethod);
            this.eventAggregator.GetEvent <TestProjectSelectedEvent>().Subscribe(SetTestProject);
        }