コード例 #1
0
        public void Test_Int_GetStep_Success()
        {
            CounterRepo  counterRepo  = new CounterRepo(db);
            ScenarioRepo scenarioRepo = new ScenarioRepo(db, counterRepo);

            Scenario scenario = new Scenario
            {
                ProjectKey   = "p1",
                ScenarioName = "sc name",
                Steps        = new List <Step>()
            };

            scenario.Steps.Add(new Step
            {
                ProjectKey  = "p1",
                Invocations = new List <Invocation>
                {
                    new Invocation
                    {
                        ProjectKey       = "p1",
                        InstanceHashCode = "someInvocationCode"
                    }
                }
            });

            scenarioRepo.Insert(scenario);

            long stepNo = scenario.Steps[0].StepNo;

            var step = scenarioRepo.GetStep(stepNo);

            Assert.IsNotNull(step);
            Assert.AreEqual("p1", step.ProjectKey);
        }
コード例 #2
0
        public void Test_Int_GetInvocation_Success()
        {
            CounterRepo  counterRepo  = new CounterRepo(db);
            ScenarioRepo scenarioRepo = new ScenarioRepo(db, counterRepo);

            var invocation = scenarioRepo.GetInvocation("1001-1001-2136472689--1922254082-2-0");

            Assert.IsNotNull(invocation);
        }
コード例 #3
0
        public void Test_Int_InitCounters_Success()
        {
            CounterRepo counterRepo = new CounterRepo(db);

            var keys        = new string[] { "project", "scenario" };
            var counterList = counterRepo.InitCounters(keys);

            Assert.AreEqual(keys.Length, counterList.Count);
            Assert.IsTrue(counterList.All(c => c.CounterValue == 1));
        }
コード例 #4
0
        public void Test_Int_GetLastCounter_Success()
        {
            CounterRepo counterRepo = new CounterRepo(db);

            string key = "scenario";

            var  counter = counterRepo.GetNextCounter(key);
            long exValue = counter.CounterValue;

            counter = counterRepo.GetNextCounter(key);

            Assert.AreEqual(exValue + 1, counter.CounterValue);
        }
コード例 #5
0
        public void Test_Int_InsertProject_Success()
        {
            CounterRepo counterRepo = new CounterRepo(db);
            ProjectRepo projectRepo = new ProjectRepo(db, counterRepo);

            var project = projectRepo.Insert(new Models.Entity.Project
            {
                ProjectDescription = "unitTestProject description",
                ProjectKey         = "unitTestProject"
            });

            Assert.IsNotNull(project);
            Assert.IsNotNull(project.Id);
            Assert.IsTrue(project.ProjectNo > 0);
        }
コード例 #6
0
        public void Test_Int_UpdateInvocation_Success()
        {
            CounterRepo  counterRepo  = new CounterRepo(db);
            ScenarioRepo scenarioRepo = new ScenarioRepo(db, counterRepo);

            string now = DateTime.Now.ToString();

            var invocation = scenarioRepo.GetInvocation("1001-31-1540425389--1922254082-1-0");

            invocation.AssertionResult = now; //meaningless update for test's sake

            scenarioRepo.UpdateInvocation(invocation);

            var updatedInvocation = scenarioRepo.GetInvocation("1001-31-1540425389--1922254082-1-0");

            Assert.AreEqual(now, updatedInvocation.AssertionResult);
        }
コード例 #7
0
        public void Test_Int_InsertStep_Success()
        {
            CounterRepo  counterRepo  = new CounterRepo(db);
            ScenarioRepo scenarioRepo = new ScenarioRepo(db, counterRepo);

            var scenario = scenarioRepo.Insert(new Scenario
            {
                ScenarioName = "stepfulScenarioName",
            });

            Step dummyStep = new Step
            {
                ScenarioNo = scenario.ScenarioNo,
                StepName   = "someEmptyStepName"
            };

            scenarioRepo.InsertStep(dummyStep);
        }
コード例 #8
0
        public void Test_Int_InsertInvocationsForStep_Success()
        {
            CounterRepo  counterRepo  = new CounterRepo(db);
            ScenarioRepo scenarioRepo = new ScenarioRepo(db, counterRepo);

            var scenario = scenarioRepo.Insert(new Scenario
            {
                ScenarioName = "aScenarioName",
                Steps        = new List <Step>
                {
                    new Step
                    {
                        StepName = "aStepName"
                    },
                    new Step
                    {
                        StepName = "bStepName"
                    }
                }
            });

            var aStep = scenario.Steps.First();

            Step dummyStep = new Step
            {
                ScenarioNo  = scenario.ScenarioNo,
                StepNo      = aStep.StepNo,
                Invocations = new List <Invocation>
                {
                    new Invocation {
                        ScenarioNo = scenario.ScenarioNo, StepNo = aStep.StepNo, InstanceHashCode = "i1"
                    },
                    new Invocation {
                        ScenarioNo = scenario.ScenarioNo, StepNo = aStep.StepNo, InstanceHashCode = "i2"
                    }
                }
            };

            scenarioRepo.InsertInvocationsForStep(dummyStep);
        }
コード例 #9
0
        public void Test_Int_UpdateStep_Success()
        {
            CounterRepo  counterRepo  = new CounterRepo(db);
            ScenarioRepo scenarioRepo = new ScenarioRepo(db, counterRepo);

            var scenario = scenarioRepo.Insert(new Scenario
            {
                ScenarioName = "stepfulScenarioName",
            });

            Step dummyStep = new Step
            {
                ScenarioNo = scenario.ScenarioNo,
                StepName   = "someEmptyStepName",
            };

            var dbStep = scenarioRepo.InsertStep(dummyStep);

            Step dummyStep2 = new Step
            {
                ScenarioNo  = scenario.ScenarioNo,
                StepName    = "someEmptyStepName2",
                Invocations = new List <Invocation> {
                    new Invocation {
                        ScenarioNo          = scenario.ScenarioNo,
                        InvocationSignature = "signature1"
                    }
                }
            };

            var dbStep2 = scenarioRepo.InsertStep(dummyStep2);

            dbStep2.StepName = "updatedStepName2";
            dbStep2.Invocations.First().InvocationSignature = "updatedSignature1";

            scenarioRepo.UpdateStep(dbStep2);
        }
コード例 #10
0
        private void InitCounters()
        {
            CounterRepo counterRepo = new CounterRepo(db);

            counterRepo.InitCounters(new string[] { "project", "scenario" });
        }