Exemplo n.º 1
0
        public void ScenarioUpdate()
        {
            ComparisionEntity activeScenario = new ComparisionScenario()
            {
                Description = "aaa",
                Guid        = null,
                Level       = null,
                Name        = "Scenariusz 1",
                Result      = null
            };
            ComparisionEntity previouScenario = new ComparisionScenario()
            {
                Description = "bbb",
                Guid        = null,
                Level       = null,
                Name        = "Scenariusz 1",
                Result      = null
            };

            WorkItemComparer wic = new WorkItemComparer(activeScenario, previouScenario, WorkItemType.TestCase);

            ComparisionResult receivedResult = wic.GetComparisionResult();
            ComparisionResult expectedResult = new ComparisionResult();

            expectedResult.OperationType = OperationType.Update;
            expectedResult.Result        = false;
            expectedResult.WorkItemType  = WorkItemType.TestCase;


            Assert.Equal(expectedResult.Result, receivedResult.Result);
            Assert.Equal(expectedResult.OperationType == OperationType.Update, receivedResult.OperationType == OperationType.Update);
        }
Exemplo n.º 2
0
        private void Compare()
        {
            if (_activeEAscenarios != null)
            {
                try
                {
                    foreach (var scenario in _activeEAscenarios)
                    {
                        var stepsResult           = new List <ComparisionResult>();
                        WorkItemComparer comparer = new WorkItemComparer();

                        var scenarioData = new ComparisionDataSet(
                            ComparerItemsFactory.MapToComparsionEntity(scenario),
                            ComparerItemsFactory.MapToComparsionEntity(
                                DbOperations.getEAscenario(scenario.PreviousVersionId)),
                            WorkItemType.TestCase,
                            scenario.Id);

                        var scenarioResult = comparer.GetComparisionResult(scenarioData);

                        var scenarioSteps = GetStepsForScenario(scenario);

                        if (scenarioSteps != null)
                        {
                            foreach (var step in scenarioSteps)
                            {
                                var stepData = new ComparisionDataSet(
                                    ComparerItemsFactory.MapToComparsionEntity(step),
                                    ComparerItemsFactory.MapToComparsionEntity(
                                        DbOperations.GetStep(step.PreviousVersionId)),
                                    WorkItemType.TestStep,
                                    step.Id);

                                var result = comparer.GetComparisionResult(stepData);

                                stepsResult.Add(result);
                            }
                        }

                        scenarioResult = AnalizeComparision(scenarioResult, stepsResult);
                        WorkItemDataSet.TestComparisionResults.Add(scenarioResult);
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(
                        "W aplikacji wystąpił błąd!\n" + e, "Błąd!",
                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    throw;
                }
            }
        }