public void GetAllLogEntries_LoadAllLogEntries_GetAListOfAllLogEntries() { ILogEntryView logView = new LogEntryView(); var logEnries = logView.GetAllLogEntries(); Assert.IsTrue(logEnries.Count > 0); }
public void TestConstruction() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.RawContent, Core.Columns.Index); view.Columns.Should().Equal(new object[] { Core.Columns.RawContent, Core.Columns.Index }); entry.VerifyGet(x => x.Columns, Times.Never); }
// private string _connectionstring = "Server=localhost;Port=3306;Database=inventarisierung;Uid=root;Pwd=....;"; //private string _getLogDataCommand = "SELECT id, pod, location, hostname, severity, timestamp, message FROM v_logentries"; //private string _confirmLogEntry = "CALL `inventarisierung`.`LogClear`({0})"; //private String _addLogEntry = "CALL `inventarisierung`.`LogMessageAdd`('{0}', '{1}', {2}, '{3}')"; public LogEntryViewModel(LogEntryView logEntryView) { CmdLoad = new DelegateCommand(OnCmdLoad); CmdConfirm = new DelegateCommand(OnCmdConfirmLogEntry); CmdAdd = new DelegateCommand(OnCmdAdd); CmdFindDuplicates = new DelegateCommand(OnCmdFindDuplicates); // _dbConnection = new DbConnection(); }
public DatenLoggerModelView() { LogEntries = new List <IEntity>(); CmdLoad = new DelegateCommand(OnCmdLoad); CmdConfirm = new DelegateCommand(OnCmdConfirm); CmdAddLog = new DelegateCommand(OnCmdAddLog); CmdDublicateCheck = new DelegateCommand(OnCmdDublicateCheck); CmdHierarchie = new DelegateCommand(OnCmdHierarchie); LogEntryView = new LogEntryView(); LoggingRepository = new LoggingRepository(); }
public static MonitoringViewModel GetInstance() { if (Instance == null) { LogEntryView monitoringRepository = new LogEntryView(); LogRepository logRepository = new LogRepository(); Instance = new MonitoringViewModel(monitoringRepository, logRepository); } return(Instance); }
public void TestOriginalDataSourceName_ColumnAvailable() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.OriginalDataSourceName); entry.SetupProperty(x => x.OriginalDataSourceName); entry.Object.OriginalDataSourceName = "F:\\important.txt"; view.OriginalDataSourceName.Should().Be("F:\\important.txt"); view.OriginalDataSourceName = "A:\\another_one.log"; entry.Object.OriginalDataSourceName.Should().Be("A:\\another_one.log"); }
public static AddLogEntryViewModel GetInstance() { if (Instance == null) { ILogEntryView logEntryView = new LogEntryView(); IDeviceRepository deviceRepository = new DeviceRepository(); ILogRepository logRepository = new LogRepository(); Instance = new AddLogEntryViewModel(logEntryView, deviceRepository, logRepository); } return(Instance); }
public void TestSourceId_ColumnAvailable() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.SourceId); entry.SetupProperty(x => x.SourceId); entry.Object.SourceId = new LogEntrySourceId(101); view.SourceId.Should().Be(new LogEntrySourceId(101)); view.SourceId = new LogEntrySourceId(201); entry.Object.SourceId.Should().Be(new LogEntrySourceId(201)); }
public void TestOriginalIndex_ColumnAvailable() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.OriginalIndex); entry.SetupProperty(x => x.OriginalIndex); entry.Object.OriginalIndex = new LogLineIndex(101); view.OriginalIndex.Should().Be(new LogLineIndex(101)); view.OriginalIndex = new LogLineIndex(9001); entry.Object.OriginalIndex.Should().Be(new LogLineIndex(9001)); }
public void TestDeltaTime_ColumnAvailable() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.DeltaTime); entry.SetupProperty(x => x.DeltaTime); entry.Object.DeltaTime = TimeSpan.FromSeconds(42); view.DeltaTime.Should().Be(TimeSpan.FromSeconds(42)); view.DeltaTime = TimeSpan.FromSeconds(9001); entry.Object.DeltaTime.Should().Be(TimeSpan.FromSeconds(9001)); }
public void TestLogLevel_ColumnAvailable() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.LogLevel); entry.SetupProperty(x => x.LogLevel); entry.Object.LogLevel = LevelFlags.Error; view.LogLevel.Should().Be(LevelFlags.Error); view.LogLevel = LevelFlags.Warning; entry.Object.LogLevel.Should().Be(LevelFlags.Warning); }
public void TestTryGetValueTyped_ColumnAvailable() { var column = new Mock <IColumnDescriptor <string> >().Object; var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, column); var expectedValue = "Hello"; entry.Setup(x => x.TryGetValue(column, out expectedValue)).Returns(true); view.TryGetValue(column, out var actualValue).Should().BeTrue(); actualValue.Should().Be(expectedValue); }
public void TestTimestamp_ColumnAvailable() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.Timestamp); entry.SetupProperty(x => x.Timestamp); entry.Object.Timestamp = new DateTime(2021, 02, 11, 15, 42, 1); view.Timestamp.Should().Be(new DateTime(2021, 02, 11, 15, 42, 1)); view.Timestamp = new DateTime(201, 02, 11, 15, 43, 1); entry.Object.Timestamp.Should().Be(new DateTime(201, 02, 11, 15, 43, 1)); }
public void TestOriginalLineNumber_ColumnAvailable() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.OriginalLineNumber); entry.SetupProperty(x => x.OriginalLineNumber); entry.Object.OriginalLineNumber = 101; view.OriginalLineNumber.Should().Be(101); view.OriginalLineNumber = 9001; entry.Object.OriginalLineNumber.Should().Be(9001); }
public void TestRawContent_ColumnAvailable() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.RawContent); entry.SetupProperty(x => x.RawContent); entry.Object.RawContent = "I want a clondyke bar, I'm hungry"; view.RawContent.Should().Be("I want a clondyke bar, I'm hungry"); view.RawContent = "I'm still hungry"; entry.Object.RawContent.Should().Be("I'm still hungry"); }
public void TestTryGetValueTyped_NoSuchColumn() { var column = new Mock <IColumnDescriptor <string> >().Object; var otherColumn = new Mock <IColumnDescriptor <string> >(); otherColumn.SetupGet(x => x.DefaultValue).Returns("<No Value>"); var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, column); view.TryGetValue(otherColumn.Object, out var actualValue).Should().BeFalse(); actualValue.Should().Be(otherColumn.Object.DefaultValue); }
public void TestGetSetValueTyped_NoSuchColumn() { var column = new Mock <IColumnDescriptor <long> >().Object; var anotherColumn = new Mock <IColumnDescriptor <long> >().Object; var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, column); new Action(() => view.GetValue(anotherColumn)).Should().Throw <NoSuchColumnException>(); entry.Verify(x => x.GetValue <long>(It.IsAny <IColumnDescriptor <long> >()), Times.Never); new Action(() => view.SetValue <long>(anotherColumn, 98L)).Should().Throw <NoSuchColumnException>(); entry.Verify(x => x.SetValue <long>(column, It.IsAny <long>()), Times.Never); }
public void TestGetSetValueTyped_ColumnAvailable() { var column = new Mock <IColumnDescriptor <long> >().Object; var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, column); entry.Setup(x => x.GetValue(column)).Returns(342L); view.GetValue(column).Should().Be(342L); entry.Verify(x => x.GetValue <long>(column), Times.Once); view.SetValue(column, 41231231L); entry.Verify(x => x.SetValue <long>(column, 41231231L), Times.Once); }
public void TestGetSetValue_ColumnAvailable() { var column = new Mock <IColumnDescriptor>().Object; var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, column); entry.Setup(x => x.GetValue(column)).Returns("Foobar"); view.GetValue(column).Should().Be("Foobar"); entry.Verify(x => x.GetValue(column), Times.Once); view.SetValue(column, "Hello"); entry.Verify(x => x.SetValue(column, "Hello"), Times.Once); }
/// <summary> /// /// </summary> /// <param name="logger"></param> private void AddLoggerTab(Logger logger) { var tabPage = new TabPage(logger.Name); var view = new LogEntryView { DataSource = logger.DataSource, Dock = DockStyle.Fill }; tabPage.Controls.Add(view); tabControl1.TabPages.Add(tabPage); tabControl1.SelectTab(tabPage); }
public void TestDeltaTime_NoSuchColumn() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.Message); new Action(() => { var unused = view.DeltaTime; }).Should().Throw <NoSuchColumnException>(); entry.VerifyGet(x => x.DeltaTime, Times.Never); new Action(() => { view.DeltaTime = TimeSpan.FromSeconds(9001); }).Should().Throw <NoSuchColumnException>(); entry.VerifySet(x => x.DeltaTime = TimeSpan.FromSeconds(9001), Times.Never); }
public void TestRawContent_NoSuchColumn() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.Message); new Action(() => { var unused = view.RawContent; }).Should().Throw <NoSuchColumnException>(); entry.VerifyGet(x => x.RawContent, Times.Never); new Action(() => { view.RawContent = "fwadwwa"; }).Should().Throw <NoSuchColumnException>(); entry.VerifySet(x => x.RawContent = "fwadwwa", Times.Never); }
public void TestLineNumber_NoSuchColumn() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.Message); new Action(() => { var unused = view.LineNumber; }).Should().Throw <NoSuchColumnException>(); entry.VerifyGet(x => x.LineNumber, Times.Never); new Action(() => { view.LineNumber = 9001; }).Should().Throw <NoSuchColumnException>(); entry.VerifySet(x => x.LineNumber = 9001, Times.Never); }
public void TestOriginalIndex_NoSuchColumn() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.Message); new Action(() => { var unused = view.OriginalIndex; }).Should().Throw <NoSuchColumnException>(); entry.VerifyGet(x => x.OriginalIndex, Times.Never); new Action(() => { view.OriginalIndex = new LogLineIndex(9001); }).Should().Throw <NoSuchColumnException>(); entry.VerifySet(x => x.OriginalIndex = new LogLineIndex(9001), Times.Never); }
public void TestOriginalDataSourceName_NoSuchColumn() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.Message); new Action(() => { var unused = view.OriginalDataSourceName; }).Should().Throw <NoSuchColumnException>(); entry.VerifyGet(x => x.OriginalDataSourceName, Times.Never); new Action(() => { view.OriginalDataSourceName = "F:\\important.txt"; }).Should().Throw <NoSuchColumnException>(); entry.VerifySet(x => x.OriginalDataSourceName = "F:\\important.txt", Times.Never); }
public void TestTimestamp_NoSuchColumn() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.Message); new Action(() => { var unused = view.Timestamp; }).Should().Throw <NoSuchColumnException>(); entry.VerifyGet(x => x.Timestamp, Times.Never); new Action(() => { view.Timestamp = new DateTime(201, 02, 11, 15, 44, 1); }).Should().Throw <NoSuchColumnException>(); entry.VerifySet(x => x.Timestamp = new DateTime(201, 02, 11, 15, 44, 1), Times.Never); }
public void TestSourceId_NoSuchColumn() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.Message); new Action(() => { var unused = view.SourceId; }).Should().Throw <NoSuchColumnException>(); entry.VerifyGet(x => x.SourceId, Times.Never); new Action(() => { view.SourceId = new LogEntrySourceId(101); }).Should().Throw <NoSuchColumnException>(); entry.VerifySet(x => x.SourceId = new LogEntrySourceId(101), Times.Never); }
public void TestLogLevel_NoSuchColumn() { var entry = new Mock <ILogEntry>(); var view = new LogEntryView(entry.Object, Core.Columns.Message); new Action(() => { var unused = view.LogLevel; }).Should().Throw <NoSuchColumnException>(); entry.VerifyGet(x => x.LogLevel, Times.Never); new Action(() => { view.LogLevel = LevelFlags.Fatal; }).Should().Throw <NoSuchColumnException>(); entry.VerifySet(x => x.LogLevel = LevelFlags.Fatal, Times.Never); }
public void AddLogEntry_AddNewLogEntry_LogEntryIsInDbAdded() { ILogRepository logRepo = new LogRepository(); ILogEntryView logView = new LogEntryView(); var logEnriesCountBeforeAdd = logView.GetAllLogEntries().Count; IEntity newEntity = CreateNewLogEntry(4); logRepo.AddLogEntry(newEntity); var logEntriesCountAfterAdd = logView.GetAllLogEntries().Count; Assert.IsTrue(logEnriesCountBeforeAdd < logEntriesCountAfterAdd); }
public void ClearLogEntriy_QuitOneLogEntry_LogEntriesListShouldBeSamller() { ILogRepository logRepo = new LogRepository(); ILogEntryView logView = new LogEntryView(); IEntity newEntity = CreateNewLogEntry(3); logRepo.AddLogEntry(newEntity); var logEnriesAfterAdd = logView.GetAllLogEntries(); var logEnriesCountAfterAdd = logEnriesAfterAdd.Count; logRepo.ClearLogEntry(logEnriesAfterAdd[logEnriesCountAfterAdd - 1]); var logEnriesCountAfterClear = logView.GetAllLogEntries().Count; Assert.IsTrue(logEnriesCountAfterClear < logEnriesCountAfterAdd); }