コード例 #1
0
        public void WorkflowCoverageReports_GetTotalCoverage_Given_TestNodesCovered_TestStepType_Is_Mock()
        {
            var sdf = Guid.NewGuid();
            var mockWarewolfWorkflow = new Mock <IWarewolfWorkflow>();

            mockWarewolfWorkflow.Setup(o => o.WorkflowNodes).Returns(new List <IWorkflowNode>
            {
                new WorkflowNode
                {
                    ActivityID = Guid.Parse("7ed4ab9c-d227-409a-acc3-18330fe6b84e"),
                    UniqueID   = Guid.Parse("7ed4ab9c-d227-409a-acc3-18330fe6b84e"),
                }
            });

            var sut = new WorkflowCoverageReports(mockWarewolfWorkflow.Object);

            sut.Add(new ServiceTestCoverageModelTo
            {
                WorkflowId          = Guid.NewGuid(),
                LastRunDate         = DateTime.Now,
                OldReportName       = "old name",
                ReportName          = "new name",
                AllTestNodesCovered = new ISingleTestNodesCovered[] { new SingleTestNodesCovered("Test", new List <IServiceTestStep>
                    {
                        new ServiceTestStepTO
                        {
                            ActivityID = Guid.Parse("7ed4ab9c-d227-409a-acc3-18330fe6b84e"),
                            UniqueID   = Guid.Parse("7ed4ab9c-d227-409a-acc3-18330fe6b84e"),
                            Type       = StepType.Mock
                        }
                    }) }
            });

            (double TotalCoverage, _, _) = sut.GetTotalCoverage();

            Assert.IsNotNull(sut.Resource);
            Assert.IsTrue(sut.HasTestReports);
            Assert.AreEqual(0, TotalCoverage);
        }
コード例 #2
0
        public IServiceTestCoverageModelTo New(Guid workflowId, ICoverageArgs args, List <IServiceTestModelTO> serviceTestModelTos)
        {
            var workflow        = _resourceCatalog.GetWorkflow(workflowId);
            var coverageReports = new WorkflowCoverageReports(workflow);
            var coverageModelTo = new ServiceTestCoverageModelTo
            {
                WorkflowId          = workflowId,
                OldReportName       = args?.OldReportName,
                ReportName          = args?.ReportName,
                LastRunDate         = DateTime.Now,
                AllTestNodesCovered = serviceTestModelTos
                                      .Select(test => new SingleTestNodesCovered(test.TestName, test.TestSteps))
                                      .ToArray()
            };

            coverageReports.Add(coverageModelTo);

            (double TotalCoverage, _, _) = coverageReports.GetTotalCoverage();

            coverageModelTo.TotalCoverage = TotalCoverage;

            return(coverageModelTo);
        }