Beispiel #1
0
        public Item BuildForRow(Scenario scenario, TestData testData)
        {
            foreach (Interaction i in scenario.Interactions)
                foreach (DataItem d in i.DataItems)
                    d.Data = testData[d.Name];

            return scenario;
        }
Beispiel #2
0
        public TestDataViewModel(IRepository repository, Scenario scenario)
        {
            this.repo = repository;

            this.scenario = scenario;

            TestDataRows = scenario.TestDataRows;
        }
        public void Setup()
        {
            scenario = new Scenario()
            {
                Name = "foo",
                Description = "bar",
                TestDataRows = new List<TestData>(),
                Interactions = new List<Interaction>()
            };

            var interaction1 = new Interaction()
            {
                Name = "Step 1",
                DataItems = new List<DataItem>()
            };

            var interaction2 = new Interaction()
            {
                Name = "Step 2",
                DataItems = new List<DataItem>()
            };

            var dataItem = new DataItem()
            {
                Name = "param1"
            };

            var dataItem2 = new DataItem()
            {
                Name = "param2"
            };

            interaction1.DataItems.Add(dataItem);
            interaction1.DataItems.Add(dataItem2);

            interaction2.DataItems.Add(dataItem);
            interaction2.DataItems.Add(dataItem2);

            var testData1 = new TestData();
            testData1.Add("param1", "foo");
            testData1.Add("param2", "bar");

            var testData2 = new TestData();
            testData2.Add("param1", "foo");
            testData2.Add("param2", "bar");

            scenario.Interactions.Add(interaction1);
            scenario.Interactions.Add(interaction2);

            scenario.TestDataRows.Add(testData1);
            scenario.TestDataRows.Add(testData2);

            scenarios = new List<Item>();
            scenarios.Add(scenario);

            built = builder.Build(scenarios);
        }
Beispiel #4
0
        public ScenarioViewModel(Scenario scenario, StoryViewModel storyViewModel)
            : base(storyViewModel, true)
        {
            Scenario = scenario;

            ShouldDelete = false;

            CreateViewModels();

            repo = App.kernel.Get<IRepository>();
        }
Beispiel #5
0
        public void BuildForScenario(Scenario scenario)
        {
            var rowIndex = 0;

            foreach (TestData t in scenario.TestDataRows)
            {
                scenario.Name = scenario.Name + " [" + rowIndex + "]";

                builtScenarios.Add(BuildForRow(scenario, t));

                rowIndex++;
            }
        }
        public void Given_Repository(bool cleanFolders)
        {
            if(cleanFolders)
                DeleteFiles();

            serializer = new ItemJsonSerializer(dataPath);

            repo = new ItemRepository(serializer);

            repo.DataPath = dataPath;

            projectItem = repo.Create<Project>() as Project;
            storyItem = repo.Create<Story>() as Story;
            scenarioItem = repo.Create<Scenario>() as Scenario;
            interactionItem = new Interaction();
            dataItem = new DataItem();
        }
        public void GivenTwoScenariosWithExclude()
        {
            scenarios = new List<Scenario>();

            var scenario1 = new Scenario()
            {
                Name = "SC1",
                Tags = { "foo" }
            };

            var scenario2 = new Scenario()
            {
                Name = "SC2",
                Tags = { "foo", "bar" }
            };

            scenarios.Add(scenario1);
            scenarios.Add(scenario2);
        }
Beispiel #8
0
        public Interaction CreateInteraction(Scenario parentScenario)
        {
            int index = 0;

            if (parentScenario.Interactions.Count > 0)
            {
                var lastInteraction = parentScenario.Interactions.First(i => i.IsLast);

                lastInteraction.IsLast = false;

                itemSerializer.Save(lastInteraction, lastInteraction.Id.ToString());

                index = lastInteraction.Index + 1;
            }

            var interaction = new Interaction() { Index = index, IsLast = true, ParentId = parentScenario.Id };

            var dataItem = CreateDataItem(interaction);

            parentScenario.InteractionIds.Add(interaction.Id);

            parentScenario.Interactions.Add(interaction);

            SaveScenario(parentScenario);

            return interaction;
        }
Beispiel #9
0
        public void SaveScenario(Scenario scenario)
        {
            itemSerializer.Save(scenario, scenario.Id.ToString());

            scenario.Interactions.ForEach(i => itemSerializer.Save(i, i.Id.ToString()));
        }
Beispiel #10
0
        public Story DeleteScenario(Story story, Scenario scenario)
        {
            story.ScenarioIds.Remove(scenario.Id);

            story.Scenarios.Remove(scenario);

            scenario.Interactions.ForEach(i => DeleteInteraction(scenario, i));

            DeleteFile(scenario.Id, scenario.Type);

            return story;
        }
Beispiel #11
0
        public Scenario DeleteInteraction(Scenario scenario, Interaction interaction)
        {
            scenario.InteractionIds.Remove(interaction.Id);

            scenario.Interactions.Remove(interaction);

            scenario.Interactions = ReIndexInteractions(scenario.Interactions);

            interaction.DataItems.ForEach(d => DeleteDataItem(interaction, d));

            DeleteFile(interaction.Id, interaction.Type);

            return scenario;
        }
Beispiel #12
0
        public Scenario CreateScenario(Story parentStory)
        {
            var scenario = new Scenario() { ParentId = parentStory.Id };

            var interaction = CreateInteraction(scenario);

            parentStory.ScenarioIds.Add(scenario.Id);

            parentStory.Scenarios.Add(scenario);

            SaveStory(parentStory);

            itemSerializer.Save(scenario, scenario.Id.ToString());

            return scenario;
        }
Beispiel #13
0
        public void CreateScenario()
        {
            var scenario = new Scenario() { ParentId = Story.Id };

            var interaction = new Interaction() { ParentId = scenario.Id };

            var dataItem = new DataItem() { ParentId = interaction.Id };

            interaction.DataItems.Add(dataItem);

            scenario.Interactions.Add(interaction);

            scenario.Name = "Scenario Name";

            Scenarios.Add(scenario);

            Story.ChildrenIds.Add(scenario.Id);

            var scenarioViewModel = new ScenarioViewModel(scenario, this) { IsSelected = true, IsExpanded = true };

            base.Children.Add(scenarioViewModel);

            Update();
        }
 public void Setup()
 {
     scenario = new Scenario();
     cloned = scenario.Clone();
 }