コード例 #1
0
 /// <summary>
 /// Initializes a new <see cref="AutomationSourceViewModel"/>.
 /// </summary>
 /// <param name="file">A file that may contain automated tests</param>
 /// <param name="testFactory">Creates automated test view-models</param>
 /// <param name="testDiscoverer">Finds tests in files</param>
 /// <param name="scheduler">Used to schedule background tasks</param>
 public AutomationSourceViewModel(TfsFile file, Func <ITestAutomation, TestAutomationViewModel> testFactory,
                                  ITestAutomationDiscoverer testDiscoverer, TaskScheduler scheduler)
 {
     _file           = file;
     _testFactory    = testFactory;
     _testDiscoverer = testDiscoverer;
     _scheduler      = scheduler;
 }
コード例 #2
0
        /// <summary>
        /// Initializes a new <see cref="FileSystemTestBrowserViewModel"/>.
        /// </summary>
        /// <param name="testCase">The test case to associate with automation</param>
        /// <param name="testFactory">Creates automated test view-models</param>
        /// <param name="testDiscoverer">Finds tests in files</param>
        /// <param name="scheduler">Used to schedule background tasks</param>
        public FileSystemTestBrowserViewModel(ITestCaseViewModel testCase,
                                              Func <ITestAutomation, TestAutomationViewModel> testFactory,
                                              ITestAutomationDiscoverer testDiscoverer, TaskScheduler scheduler)
        {
            _testFactory    = testFactory;
            _testDiscoverer = testDiscoverer;
            _scheduler      = scheduler;
            TestCase        = testCase;

            _selectedFile = Property.New(this, p => p.SelectedFile, OnPropertyChanged)
                            .EqualWhen((f1, f2) => FileInfoPathEqualityComparer.Instance.Equals(f1, f2));
            _tests        = Property.New(this, p => p.Tests, OnPropertyChanged);
            _selectedTest = Property.New(this, p => p.SelectedTest, OnPropertyChanged)
                            .AlsoChanges(p => p.CanSaveTestCase);
            _hasBeenSaved = Property.New(this, p => p.HasBeenSaved, OnPropertyChanged);
            _canBrowse    = Property.New(this, p => p.CanBrowse, OnPropertyChanged);
            CanBrowse     = true;

            Tests = new ObservableCollection <TestAutomationViewModel>();
            SaveTestCaseCommand = Command.For(this)
                                  .DependsOn(p => p.CanSaveTestCase)
                                  .Executes(SaveTestCase);
        }
コード例 #3
0
		/// <summary>
		/// Initializes a new <see cref="FileSystemTestBrowserViewModel"/>.
		/// </summary>
		/// <param name="testCase">The test case to associate with automation</param>
		/// <param name="testFactory">Creates automated test view-models</param>
		/// <param name="testDiscoverer">Finds tests in files</param>
		/// <param name="scheduler">Used to schedule background tasks</param>
		public FileSystemTestBrowserViewModel(ITestCaseViewModel testCase,
		                                      Func<ITestAutomation, TestAutomationViewModel> testFactory,
		                                      ITestAutomationDiscoverer testDiscoverer, TaskScheduler scheduler)
		{
			_testFactory = testFactory;
			_testDiscoverer = testDiscoverer;
			_scheduler = scheduler;
			TestCase = testCase;

		    _selectedFile = Property.New(this, p => p.SelectedFile, OnPropertyChanged)
		                            .UsingPathEquality();
			_tests = Property.New(this, p => p.Tests, OnPropertyChanged);
			_selectedTest = Property.New(this, p => p.SelectedTest, OnPropertyChanged)
									.AlsoChanges(p => p.CanSaveTestCase);
			_hasBeenSaved = Property.New(this, p => p.HasBeenSaved, OnPropertyChanged);
			_canBrowse = Property.New(this, p => p.CanBrowse, OnPropertyChanged);
			CanBrowse = true;

			Tests = new ObservableCollection<TestAutomationViewModel>();
			SaveTestCaseCommand = Command.For(this)
										 .DependsOn(p => p.CanSaveTestCase)
										 .Executes(SaveTestCase);
		}
コード例 #4
0
 /// <summary>
 /// Initializes a new <see cref="FileSystemTestBrowserViewModel"/>.
 /// </summary>
 /// <param name="testDiscoverer">Finds tests in files</param>
 public FileSystemTestBrowserViewModel(ITestAutomationDiscoverer testDiscoverer)
     : this()
 {
     _testDiscoverer = testDiscoverer;
 }
コード例 #5
0
 /// <summary>
 /// Initializes a new <see cref="AutomationSourceViewModel"/>.
 /// </summary>
 /// <param name="file">A file that may contain automated tests</param>
 /// <param name="testDiscoverer">Finds tests in files</param>
 public AutomationSourceViewModel(TfsFile file,
                                  ITestAutomationDiscoverer testDiscoverer)
 {
     _file           = file;
     _testDiscoverer = testDiscoverer;
 }