public void Generate() { var impls = IncorrectImplementationHelper.GetTypes(); var code = string.Join(Environment.NewLine, impls.Select(imp => $"public class {imp.Name}_Tests : {nameof(IncorrectImplementation_TestsBase)} {{}}") ); Console.WriteLine(code); }
private static IEnumerable <ImplementationResult> GetIncorrectImplementationResults( ITestRunner testRunner, IEnumerable <Type> implementations) { var implTypeToTestsType = IncorrectImplementationHelper.GetTests() .ToDictionary(it => it.CreateTasks().GetType(), it => it.GetType()); foreach (var implementation in implementations) { var failed = GetFailedTests(testRunner, implementation, implTypeToTestsType[implementation]).ToArray(); yield return(new ImplementationResult(implementation.Name, failed)); } }
public void CheckAllTestsAreInPlace() { var implTypes = IncorrectImplementationHelper.GetTypes(); var testedImpls = IncorrectImplementationHelper.GetTests() .Select(it => it.CreateTasks()) .ToArray(); foreach (var impl in implTypes) { Assert.NotNull(testedImpls.SingleOrDefault(it => it.GetType().FullName == impl.FullName), "Single implementation of tests for {0} not found. Regenerate tests with test above!", impl.FullName); } }
public static void Main() { var testPackage = new TestPackage(Assembly.GetExecutingAssembly().Location); using (var engine = new TestEngine()) using (var testRunner = engine.GetRunner(testPackage)) if (TestsAreValid(testRunner)) { var incorrectImplementations = IncorrectImplementationHelper.GetTypes(); var results = GetIncorrectImplementationResults(testRunner, incorrectImplementations).ToList(); var task1Results = results.Take(4); var task2Results = results.Skip(4).Take(6); var task3Results = results.Skip(10); Console.WriteLine(); Console.WriteLine("Task1. SumAbs"); foreach (var result in task1Results) { WriteImplementationResultToConsole(result); } Console.WriteLine(); Console.WriteLine("Task2. Move"); foreach (var result in task2Results) { WriteImplementationResultToConsole(result); } Console.WriteLine(); Console.WriteLine("Task3. Distinct"); foreach (var result in task3Results) { WriteImplementationResultToConsole(result); } } }