コード例 #1
0
ファイル: AppDataFileTests.cs プロジェクト: Jonsey/TDDTodo
        public void ShouldLoadSavedDataOnStartup()
        {
            var viewModel1 = CreateAndSelectOneFeature();

            var viewModel2 = new FeaturesViewModel();
            Assert.AreEqual(viewModel1.Features[0].Title, viewModel2.Features[0].Title);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        public void ShouldNotFailWhenNoFeatureHasBeenSelected()
        {
            var viewModel = new FeaturesViewModel();

            Assert.IsNull(viewModel.SelectedFeaturesScenarios);
        }
コード例 #7
0
        public void ShouldNotBeAbleToAddItemsIfNoFeatureSelected()
        {
            var viewModel = new FeaturesViewModel();
            viewModel.Title = "Feature 1";
            viewModel.NewFeatureCommand.Execute();

            Assert.IsFalse(viewModel.AddScenarioCommand.CanExecute(FeatureTitle));
        }
コード例 #8
0
        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);
        }
コード例 #9
0
ファイル: MainWindow.xaml.cs プロジェクト: Jonsey/TDDTodo
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new FeaturesViewModel();
 }