예제 #1
0
        /// <summary>
        /// Initializes a new <see cref="ManualAutomationEntryViewModel"/>.
        /// </summary>
        /// <param name="testCase">The test case to associate with automation</param>
        public ManualAutomationEntryViewModel(ITestCaseViewModel testCase)
        {
            TestCase = testCase;

            _name = Property.New(this, p => p.Name, OnPropertyChanged)
                    .AlsoChanges(p => p.CanSaveTestCase);
            _storageLocation = Property.New(this, p => p.StorageLocation, OnPropertyChanged)
                               .AlsoChanges(p => p.CanSaveTestCase);
            _testType = Property.New(this, p => p.TestType, OnPropertyChanged)
                        .AlsoChanges(p => p.CanSaveTestCase);
            _hasBeenSaved = Property.New(this, p => p.HasBeenSaved, OnPropertyChanged);

            SaveTestCaseCommand = Command.For(this)
                                  .DependsOn(p => p.CanSaveTestCase)
                                  .Executes(SaveTestCase);

            var existingAutomation = TestCase.GetAutomation();

            if (existingAutomation != null)
            {
                Name            = existingAutomation.Name;
                StorageLocation = existingAutomation.Storage;
                TestType        = existingAutomation.TestType;
            }
        }
        public TestBrowserViewModel(ITestCaseViewModel testCase,
                                    ITestIdentifierFactory identifierFactory,
                                    FileSystemTestBrowserViewModel fileSystemBrowser,
                                    SourceControlTestBrowserViewModel sourceControlBrowser) : this()
        {
            _identifierFactory = identifierFactory;

            FileSystemBrowser = fileSystemBrowser;
            FileSystemBrowser.PropertyChanged += Browser_PropertyChanged;

            SourceControlBrowser = sourceControlBrowser;
            SourceControlBrowser.PropertyChanged += Browser_PropertyChanged;

            TestCase       = testCase;
            TestAutomation = TestCase.GetAutomation();
        }
예제 #3
0
        /// <summary>
        /// Initializes a new <see cref="SourceControlTestBrowserViewModel"/>.
        /// </summary>
        /// <param name="solutions">Existing solutions in source control</param>
        /// <param name="testCase">The test case to associate with automation</param>
        /// <param name="solutionFactory">Creates solution view-models</param>
        public SourceControlTestBrowserViewModel(IEnumerable <TfsSolution> solutions,
                                                 ITestCaseViewModel testCase,
                                                 Func <TfsSolution, SolutionViewModel> solutionFactory)
        {
            TestCase = testCase;

            _solutions    = Property.New(this, p => p.Solutions, OnPropertyChanged);
            _selectedTest = Property.New(this, p => p.SelectedTest, OnPropertyChanged)
                            .AlsoChanges(p => p.CanSaveTestCase);
            _hasBeenSaved = Property.New(this, p => p.HasBeenSaved, OnPropertyChanged);

            Solutions = new ObservableCollection <SolutionViewModel>(solutions.Select(solutionFactory));

            SaveTestCaseCommand = Command.For(this)
                                  .DependsOn(p => p.CanSaveTestCase)
                                  .Executes(SaveTestCase);
        }
        /// <summary>
        /// Initializes a new <see cref="SourceControlTestBrowserViewModel"/>.
        /// </summary>
        /// <param name="solutions">Existing solutions in source control</param>
        /// <param name="testCase">The test case to associate with automation</param>
        /// <param name="solutionFactory">Creates solution view-models</param>
        public SourceControlTestBrowserViewModel(IEnumerable<TfsSolution> solutions,
	                                             ITestCaseViewModel testCase,
	                                             Func<TfsSolution, SolutionViewModel> solutionFactory)
        {
            TestCase = testCase;

            _solutions = Property.New(this, p => p.Solutions, OnPropertyChanged);
            _selectedTest = Property.New(this, p => p.SelectedTest, OnPropertyChanged)
                                    .AlsoChanges(p => p.CanSaveTestCase);
            _hasBeenSaved = Property.New(this, p => p.HasBeenSaved, OnPropertyChanged);

            Solutions = new ObservableCollection<SolutionViewModel>(solutions.Select(solutionFactory));

            SaveTestCaseCommand = Command.For(this)
                                         .DependsOn(p => p.CanSaveTestCase)
                                         .Executes(SaveTestCase);
        }
예제 #5
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);
        }
		/// <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);
		}
        /// <summary>
        /// Initializes a new <see cref="ManualAutomationEntryViewModel"/>.
        /// </summary>
        /// <param name="testCase">The test case to associate with automation</param>
        public ManualAutomationEntryViewModel(ITestCaseViewModel testCase)
        {
            TestCase = testCase;

            _name = Property.New(this, p => p.Name, OnPropertyChanged)
                            .AlsoChanges(p => p.CanSaveTestCase);
            _storageLocation = Property.New(this, p => p.StorageLocation, OnPropertyChanged)
                                       .AlsoChanges(p => p.CanSaveTestCase);
            _testType = Property.New(this, p => p.TestType, OnPropertyChanged)
                                .AlsoChanges(p => p.CanSaveTestCase);
            _hasBeenSaved = Property.New(this, p => p.HasBeenSaved, OnPropertyChanged);

            SaveTestCaseCommand = Command.For(this)
                                         .DependsOn(p => p.CanSaveTestCase)
                                         .Executes(SaveTestCase);

            var existingAutomation = TestCase.GetAutomation();
            if (existingAutomation != null)
            {
                Name = existingAutomation.Name;
                StorageLocation = existingAutomation.Storage;
                TestType = existingAutomation.TestType;
            }
        }
예제 #8
0
 private FileSystemTestBrowserViewModel CreateFileSystemBrowser(ITestCaseViewModel testCase)
 {
     return(new FileSystemTestBrowserViewModel(testCase, _ => null, Mock.Of <ITestAutomationDiscoverer>(), new SynchronousTaskScheduler()));
 }
예제 #9
0
 private SourceControlTestBrowserViewModel CreateSourceControlBrowser(IEnumerable <TfsSolution> solutions, ITestCaseViewModel testCase)
 {
     return(new SourceControlTestBrowserViewModel(solutions, testCase, _ => null));
 }
예제 #10
0
 /// <summary>
 /// Initializes a new <see cref="AutomatedTestSelectedEventArgs"/>.
 /// </summary>
 /// <param name="testCase">The test case associated with the automated test</param>
 /// <param name="testAutomation">The selected automated test</param>
 public AutomatedTestSelectedEventArgs(ITestCaseViewModel testCase, ITestAutomation testAutomation)
 {
     TestCase       = testCase;
     TestAutomation = testAutomation;
 }
 /// <summary>
 /// Initializes a new <see cref="AutomatedTestSelectedEventArgs"/>.
 /// </summary>
 /// <param name="testCase">The test case associated with the automated test</param>
 /// <param name="testAutomation">The selected automated test</param>
 public AutomatedTestSelectedEventArgs(ITestCaseViewModel testCase, ITestAutomation testAutomation)
 {
     TestCase = testCase;
     TestAutomation = testAutomation;
 }