private static SqlServerErrorLogSource CreateSourceWithCustomSchema(int numberOfLogs) { var settings = new FakeSettingsManager(); settings.SetMaxNumberOfLogs(numberOfLogs); return new SqlServerErrorLogSource(@"data source=.;Initial Catalog=ElmahLogAnalyzer;Integrated Security=SSPI", "dbo", null, new ErrorLogFileParser(new FakeLog(), new ClientInformationResolver()), settings, new FakeLog()); }
private SqlServerCompactErrorLogSource CreateSource(int numberOfLogs) { var settings = new FakeSettingsManager(); settings.SetMaxNumberOfLogs(numberOfLogs); var connectionstring = string.Format("data source={0};", TestSqlServerCompactDatabase); return new SqlServerCompactErrorLogSource(connectionstring, new ErrorLogFileParser(new FakeLog(), new ClientInformationResolver()), settings, new FakeLog()); }
protected ErrorLogRepository CreateRepository(int maxNumberOfLogs = -1) { var fileSystemHelper = new FileSystemHelper(); var log = new FakeLog(); var settings = new FakeSettingsManager(); settings.SetMaxNumberOfLogs(maxNumberOfLogs); var parser = new ErrorLogFileParser(log, new ClientInformationResolver()); var datasource = new FileErrorLogSource(TestFilesDirectory, fileSystemHelper, parser, settings, log); var repository = new ErrorLogRepository(datasource); return repository; }
public void GetLogs_MaxNumberOfLogsIsTen_ParsesTenLatestLogsInDirectory() { // arrange var settings = new FakeSettingsManager(); settings.SetMaxNumberOfLogs(10); var source = new FileErrorLogSource(TestFilesDirectory, new FileSystemHelper(), new ErrorLogFileParser(new FakeLog(), new ClientInformationResolver()), settings, new FakeLog()); // act var result = source.GetLogs(); // assert Assert.That(result.Count, Is.EqualTo(10)); }