public async Task ExecuteMutationAsync_WhenExecuteMutationAndTestsPass_ShouldSetMutationsAsSurvived()
        {
            var compiler   = ProjectCompilerCreator.CreatePositiveCompiler(_fileSystem);
            var testRunner = TestRunnerClientCreator.CreatePositive();

            var mutationDocumentExecutor = new MutationDocumentExecutor(compiler, _dependency, testRunner, _fileSystem);
            var result = await mutationDocumentExecutor.ExecuteMutationAsync(_config, _mutationDocument);

            Assert.IsTrue(result.Survived);
        }
Ejemplo n.º 2
0
        public async Task RunUnitTests_WhenAndTestsPass_ShouldGetBaselineResults()
        {
            var baselineCreatorRunUnitTestsHandler = new BaselineCreatorRunUnitTestsHandler(
                TestRunnerClientCreator.CreatePositive(),
                _testRunnerDependencyFilesHandler);

            var result = await baselineCreatorRunUnitTestsHandler.RunUnitTests(_config, BaseLineDirectoryPath);

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual("TestProject", result.First().TestProjectName);
            Assert.AreEqual(TimeSpan.FromSeconds(1), result.First().ExecutionTime);
        }
        public void ExecuteMutationAsync_WhenExecuteMutationAndNoMappingMatch_ShouldThrowException()
        {
            _config.MutationProjects.First().MappedTestProjects = new List <string> {
                "TestProject2"
            };

            var compiler   = ProjectCompilerCreator.CreatePositiveCompiler(_fileSystem);
            var testRunner = TestRunnerClientCreator.CreatePositive();

            var mutationDocumentExecutor = new MutationDocumentExecutor(compiler, _dependency, testRunner, _fileSystem);

            Assert.ThrowsAsync <MutationDocumentException>(async() => await mutationDocumentExecutor.ExecuteMutationAsync(_config, _mutationDocument));
        }
        public async Task ExecuteMutationAsync_WhenExecuteMutationAndCancel_ShouldGetMutationCancelled()
        {
            var compiler     = ProjectCompilerCreator.CreatePositiveCompiler(_fileSystem);
            var testRunner   = TestRunnerClientCreator.CreatePositive();
            var cancellation = new CancellationTokenSource();
            var token        = cancellation.Token;

            cancellation.Cancel();

            var mutationDocumentExecutor = new MutationDocumentExecutor(compiler, _dependency, testRunner, _fileSystem);
            var result = await mutationDocumentExecutor.ExecuteMutationAsync(_config, _mutationDocument, token);

            Assert.AreEqual("Mutation cancelled", result.UnexpectedError);
        }
Ejemplo n.º 5
0
        public async Task CreateBaselineAsync_WhenCreatingBaseline_ShouldGetBaselineInfoAndDeleteBaselineDirectory()
        {
            var baselineCreator = new BaselineCreator(
                _fileSystem,
                new BaselineCreatorCompileMutationProjectsHandler(ProjectCompilerCreator.CreatePositiveCompiler(_fileSystem), _fileSystem),
                new BaselineCreatorRunUnitTestsHandler(TestRunnerClientCreator.CreatePositive(), new TestRunnerDependencyFilesHandler(_fileSystem)),
                new BaselineCreatorLogSummaryHandler());

            var result = await baselineCreator.CreateBaselineAsync(_config);

            Assert.AreEqual(1, result.Count);
            Assert.AreEqual("TestProject", result.First().TestProjectName);
            Assert.AreEqual(TimeSpan.FromSeconds(1), result.First().ExecutionTime);
        }