int GetTotalSpecificationCount(MSpec mspecResults) { return mspecResults.Assembly.Sum( assemblies => assemblies.Concern.Sum( concerns => concerns.Context.Sum( context => (from spec in context.Specification select spec).Count()))); }
int GetTotalNotImplemented(MSpec mspecResults) { return mspecResults.Assembly.Sum( assemblies => assemblies.Concern.Sum( concerns => concerns.Context.Sum( context => (from spec in context.Specification where spec.Status == "not-implemented" select spec).Count()))); }
void BuildTestSuiteProjectNodes(string testRunTime, TestResults results, MSpec mspecResults) { foreach (var assembly in mspecResults.Assembly) { var assemblySuite = new TestSuite(); assemblySuite.TestSuiteType = "Project"; assemblySuite.Executed = true; assemblySuite.Time = testRunTime; assemblySuite.Asserts = GetAssemblySpecificationCount(assembly); assemblySuite.Name = Path.Combine(Path.GetDirectoryName(mspecResults.Assembly[0].Location), mspecResults.Assembly[0].Name); if (GetAssemblySpecificationFailures(assembly) == 0 ) { assemblySuite.Result = "Success"; assemblySuite.Success = true; } else { assemblySuite.Result = "Failure"; assemblySuite.Success = false; } var assemblyResults = new Results(); assemblySuite.Results = assemblyResults; BuildTestSuiteNameSpaceNodes(testRunTime, assemblyResults, assembly); results.TestSuite = assemblySuite; } }
int GetTotalFailures(MSpec mspecResults) { return mspecResults.Assembly.Sum( assembly => assembly.Concern.Sum(concern => GetConsernSpecificationFailures(concern))); }
static string FormatTestRunTime(MSpec mspecResults) { int milliseconds; int.TryParse(mspecResults.Run.Time, out milliseconds); var ts = new TimeSpan(0,0,0,0,milliseconds); string testRunTime = string.Format("{0}.{1}", ts.Seconds,ts.Milliseconds); return testRunTime; }