コード例 #1
0
        public void RemoveSpecUnitFromTests(string solutionFolder)
        {
            var filePaths = _filesProvider.GetFilePaths(solutionFolder);

            foreach (var file in filePaths)
            {
                _fileTransformer.Transform(file);
            }
        }
コード例 #2
0
        public async Task TestMatch()
        {
            var fs          = MockFileSystem.MockFileSystemSimple();
            var logger      = new Mock <ILogger>();
            var transformer = new FileTransformer(fs, logger.Object);
            var collector   = new ConcurrentBag <string>();
            var action      = new FileAction(fs, (path) => path.ToLowerInvariant().EndsWith(".sql"), (path) => { collector.Add(path); }, (_) => { });

            await transformer.Transform(@"C:\home\foo\tests", action);

            Assert.Equal(4, collector.Count);
        }
コード例 #3
0
        public async Task TestSuccess()
        {
            var fs          = MockFileSystem.MockFileSystemSimple();
            var logger      = new Mock <ILogger>();
            var transformer = new FileTransformer(fs, logger.Object);
            var collector   = new ConcurrentBag <string>();
            var action      = new FileAction(fs, (_) => true, (path) => { collector.Add(path); }, (_) => { });

            await transformer.Transform(@"C:\home\foo\tests", action);

            Assert.Equal(6, collector.Count);
        }
コード例 #4
0
        public async Task TestAllTransformationStepsAreInvoked()
        {
            var fs          = MockFileSystem.MockFileSystemSimple();
            var logger      = new Mock <ILogger>();
            var transformer = new FileTransformer(fs, logger.Object);
            var collector   = new MockCollectOutput();
            var action      = new FileAction(fs, (_) => true, (_) => { }, (_) => { }).Add(collector);

            await transformer.Transform(@"C:\home\foo\tests", action);

            Assert.Equal(6, collector.Inputs.Count);
        }
コード例 #5
0
        public void RemoveSpecUnitUsage(string fileName, string expectedFileName)
        {
            string binFolder       = GetBinFolderPath();
            string destinationFile = Path.Combine(binFolder, TEMP_FOLDER, fileName);

            MoveFileToTempFolder(binFolder, destinationFile, fileName);

            _specUnitRemover.Transform(destinationFile);

            var actualLines   = File.ReadAllLines(destinationFile);
            var expectedLines = File.ReadAllLines(Path.Combine(binFolder, TEST_CASES_FOLDER, expectedFileName));

            for (int i = 0; i < actualLines.Length; i++)
            {
                actualLines[i].Should().Be(expectedLines[i]);
            }
        }
コード例 #6
0
        public async Task TestFailed()
        {
            var fs          = MockFileSystem.MockFileSystemSimple();
            var logger      = new Mock <ILogger>();
            var transformer = new FileTransformer(fs, logger.Object);
            var success     = new ConcurrentBag <string>();
            var reject      = new ConcurrentBag <string>();
            var action      = new FileAction(
                fs,
                (path) => path.ToLowerInvariant().EndsWith(".sql"),
                (path) => { success.Add(path); }, (path) => { reject.Add(path); })
                              .Add(new MockRejectContent("..."));

            await transformer.Transform(@"C:\home\foo\tests", action);

            Assert.Equal(2, success.Count);
            Assert.Equal(2, reject.Count);
        }