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); }
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); }
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); }
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); }