public void ShouldLoadSavedDataOnStartup() { var viewModel1 = CreateAndSelectOneFeature(); var viewModel2 = new FeaturesViewModel(); Assert.AreEqual(viewModel1.Features[0].Title, viewModel2.Features[0].Title); }
public void CanCreateMultipleFeatures() { var viewModel = new FeaturesViewModel(); viewModel.Title = "Feature 1"; viewModel.NewFeatureCommand.Execute(); viewModel.Title = "Feature 2"; viewModel.NewFeatureCommand.Execute(); Assert.AreEqual(2, viewModel.Features.Count); }
protected FeaturesViewModel CreateAndSelectOneFeature() { var viewModel = new FeaturesViewModel(); viewModel.AddScenarioCommand.CanExecuteChanged += MarkCanExecuteChanged; viewModel.PropertyChanged += MarkPropertyChanged; viewModel.Title = "Feature 1"; viewModel.Detail = "In order the do something As a user I want to be able to do something"; viewModel.NewFeatureCommand.Execute(); viewModel.SelectedFeature = viewModel.Features[0]; return viewModel; }
public void ItemsFeatureShouldRelateToSelectedFeature() { var viewModel = new FeaturesViewModel(); viewModel.Title = "Feature 1"; viewModel.NewFeatureCommand.Execute(); viewModel.Title = "Feature 2"; viewModel.NewFeatureCommand.Execute(); viewModel.SelectedFeature = viewModel.Features[1]; viewModel.AddScenarioCommand.Execute("Item 1"); viewModel.SelectedFeature = viewModel.Features[0]; viewModel.AddScenarioCommand.Execute("Item 0"); viewModel.SelectedFeature = viewModel.Features[1]; Assert.AreEqual("Item 1", viewModel.SelectedFeature.Scenarios[0].Title); }
public void ShouldAddNewItemsToTheSelectedFeature() { var viewModel = new FeaturesViewModel(); viewModel.Title = "Feature 1"; viewModel.NewFeatureCommand.Execute(); viewModel.Title = "Feature 2"; viewModel.NewFeatureCommand.Execute(); viewModel.SelectedFeature = viewModel.Features[1]; Assert.IsTrue(viewModel.AddScenarioCommand.CanExecute(FeatureTitle), "Cannot add scenario."); viewModel.AddScenarioCommand.Execute(FeatureTitle); Assert.AreEqual(FeatureTitle, viewModel.Features[1].Scenarios[0].Title); }
public void ShouldNotFailWhenNoFeatureHasBeenSelected() { var viewModel = new FeaturesViewModel(); Assert.IsNull(viewModel.SelectedFeaturesScenarios); }
public void ShouldNotBeAbleToAddItemsIfNoFeatureSelected() { var viewModel = new FeaturesViewModel(); viewModel.Title = "Feature 1"; viewModel.NewFeatureCommand.Execute(); Assert.IsFalse(viewModel.AddScenarioCommand.CanExecute(FeatureTitle)); }
public void ShouldExposeSelectedFeaturesScenarios() { var viewModel = new FeaturesViewModel(); viewModel.Title = "Feature 1"; viewModel.NewFeatureCommand.Execute(); viewModel.Title = "Feature 2"; viewModel.NewFeatureCommand.Execute(); viewModel.SelectedFeature = viewModel.Features[1]; viewModel.AddScenarioCommand.Execute(FeatureTitle); Assert.AreEqual(FeatureTitle, viewModel.SelectedFeaturesScenarios[0].Title); }
public MainWindow() { InitializeComponent(); DataContext = new FeaturesViewModel(); }