public void WhenCollectingBugDatabaseCacheAndDllIsEmptyShouldReturn() { this.commandLineArgs = new P4ExtractCommandLineArgs() { BugDatabaseDLL = string.Empty }; this.processor = new PerforceCodeChurnProcessor(processWrapperMock.Object, changesParserMock.Object, describeParserMock.Object, commandLineParserMock.Object, bugDatabseMock.Object, loggerMock.Object, stopWatchMock.Object, outputProcessorMock.Object, commandLineArgs); processor.QueryBugDatabase(); this.bugDatabseMock.Verify(b => b.ProcessBugDatabase(It.IsAny <string>(), It.IsAny <IEnumerable <string> >()), Times.Never); }
public void WhenCollectingBugDatabaseCacheAndbugDatabaseNotSetShouldThrow() { this.commandLineArgs = new P4ExtractCommandLineArgs() { BugDatabaseDLL = "some/path/to.dll", BugDatabaseOutputFile = "some/path/to/output/files" }; this.processor = new PerforceCodeChurnProcessor(processWrapperMock.Object, changesParserMock.Object, describeParserMock.Object, commandLineParserMock.Object, null, loggerMock.Object, stopWatchMock.Object, outputProcessorMock.Object, commandLineArgs); Action collect = () => processor.QueryBugDatabase(); Assert.Throws <NullReferenceException>(collect); }
public void WhenCollectingBugDatabaseCacheAndBugCacheNullShouldReturn() { this.commandLineArgs = new P4ExtractCommandLineArgs() { BugDatabaseDLL = "some/path/to.dll", BugDatabaseOutputFile = "some/path/to/output/files" }; this.bugDatabseMock .Setup(b => b.ProcessBugDatabase(It.IsAny <string>(), It.IsAny <IEnumerable <string> >())) .Returns((Dictionary <DateTime, Dictionary <string, WorkItem> >)null); this.processor = new PerforceCodeChurnProcessor(processWrapperMock.Object, changesParserMock.Object, describeParserMock.Object, commandLineParserMock.Object, bugDatabseMock.Object, loggerMock.Object, stopWatchMock.Object, outputProcessorMock.Object, commandLineArgs); processor.QueryBugDatabase(); this.loggerMock.Verify(l => l.LogToConsole(It.IsAny <string>()), Times.Never); }
public void WhenCollectingBugDatabaseCacheShouldProcessOutput() { this.commandLineArgs = new P4ExtractCommandLineArgs() { BugDatabaseDLL = "some/path/to.dll", BugDatabaseOutputFile = "some/path/to/output/files" }; this.bugDatabseMock .Setup(b => b.ProcessBugDatabase(It.IsAny <string>(), It.IsAny <IEnumerable <string> >())) .Returns(new Dictionary <DateTime, Dictionary <string, WorkItem> >()); this.processor = new PerforceCodeChurnProcessor(processWrapperMock.Object, changesParserMock.Object, describeParserMock.Object, commandLineParserMock.Object, bugDatabseMock.Object, loggerMock.Object, stopWatchMock.Object, outputProcessorMock.Object, commandLineArgs); processor.QueryBugDatabase(); this.outputProcessorMock .Verify(o => o.ProcessOutput(this.commandLineArgs.BugDatabaseOutputType, this.commandLineArgs.BugDatabaseOutputFile, It.IsAny <Dictionary <DateTime, Dictionary <string, WorkItem> > >()), Times.Once); }
private static int RunPerforceCodeChurnProcessor(P4ExtractCommandLineArgs a) { var processWrapper = new ProcessWrapper(); var changesParser = new ChangesParser(); var describeParser = new DescribeParser(); var commandLineParser = new CommandLineParser(); var logger = new ConsoleLoggerWithTimestamp(); var stopWatch = new StopWatchWrapper(); var outputProcessor = new JsonOutputProcessor(new DataConverter(), new FileStreamFactory(), logger); var bugDatabaseFactory = new BugDatabaseFactory(); var bugDatabaseDllLoader = new BugDatabaseDllLoader(logger, bugDatabaseFactory); var webRequest = new WebRequest(new HttpClientWrapperFactory(bugDatabaseFactory)); var fileSystem = new FileSystem(); var jsonParser = new JsonListParser <WorkItem>(new FileStreamFactory()); var bugDatabaseProcessor = new BugDatabaseProcessor(bugDatabaseDllLoader, webRequest, fileSystem, jsonParser, logger, a.BugDatabaseOutputFile); var processor = new PerforceCodeChurnProcessor(processWrapper, changesParser, describeParser, commandLineParser, bugDatabaseProcessor, logger, stopWatch, outputProcessor, a); processor.QueryBugDatabase(); return(processor.Extract()); }
private static int RunPerforceToCosmosDbCodeChurnProcessor(P4ExtractToCosmosDbCommandLineArgs a) { var processWrapper = new ProcessWrapper(); var changesParser = new ChangesParser(); var describeParser = new DescribeParser(); var commandLineParser = new CommandLineParser(); var logger = new ConsoleLoggerWithTimestamp(); var stopWatch = new StopWatchWrapper(); var bugDatabaseFactory = new BugDatabaseFactory(); var bugDatabaseDllLoader = new BugDatabaseDllLoader(logger, bugDatabaseFactory); var webRequest = new WebRequest(new HttpClientWrapperFactory(bugDatabaseFactory)); var fileSystem = new FileSystem(); var cosmosConnection = new CosmosConnection(new DatabaseFactory(a, JsonSerializerSettingsFactory.CreateDefaultSerializerSettingsForCosmosDB()), a.DatabaseId, Properties.Settings.Default.CosmosBulkBatchSize); var dataDocumentRepository = new DataDocumentRepository(cosmosConnection, a.CodeChurnCosmosContainer); var cosmosOutputProcessor = new CosmosDbOutputProcessor(logger, dataDocumentRepository, new DataConverter(), a.CosmosProjectName, Properties.Settings.Default.CosmosBulkBatchSize); var bugDatabaseProcessor = new CosmosDbBugDatabaseProcessor(bugDatabaseDllLoader, fileSystem, webRequest, logger, dataDocumentRepository, a.CosmosProjectName); var processor = new PerforceCodeChurnProcessor(processWrapper, changesParser, describeParser, commandLineParser, bugDatabaseProcessor, logger, stopWatch, cosmosOutputProcessor, a); processor.QueryBugDatabase(); return(processor.Extract()); }