public void TestMoveBefore2() { var dataSources = new DataSources(); var a = new DataSource(@"A"); var b = new DataSource(@"B"); dataSources.Add(a); dataSources.Add(b); dataSources.MoveBefore(a, b); dataSources.Should().Equal(a, b); }
public void TestCtor3() { var settings = new Tailviewer.Settings.DataSources { new DataSource("test1.log") { Id = DataSourceId.CreateNew() }, new DataSource("test2.log") { Id = DataSourceId.CreateNew() }, new DataSource("test.log") { Id = DataSourceId.CreateNew() } }; var merged1 = new DataSource { Id = DataSourceId.CreateNew() }; settings.Add(merged1); var merged2 = new DataSource { Id = DataSourceId.CreateNew() }; settings.Add(merged2); var merged3 = new DataSource { Id = DataSourceId.CreateNew() }; settings.Add(merged3); settings[0].ParentId = merged1.Id; settings[1].ParentId = merged2.Id; settings[2].ParentId = merged3.Id; using (var dataSources = new Tailviewer.BusinessLogic.DataSources.DataSources(_logFileFactory, _scheduler, settings)) { dataSources.Count.Should().Be(6, "Because we've loaded 6 data sources"); var mergedDataSource1 = dataSources[3] as MergedDataSource; mergedDataSource1.Should().NotBeNull(); mergedDataSource1.OriginalSources.Should().Equal(new object[] { dataSources[0] }); var mergedDataSource2 = dataSources[4] as MergedDataSource; mergedDataSource2.Should().NotBeNull(); mergedDataSource2.OriginalSources.Should().Equal(new object[] { dataSources[1] }); var mergedDataSource3 = dataSources[5] as MergedDataSource; mergedDataSource3.Should().NotBeNull(); mergedDataSource3.OriginalSources.Should().Equal(new object[] { dataSources[2] }); } }
public void TestMoveBefore5() { var dataSources = new DataSources(); var a = new DataSource(@"A"); var b = new DataSource(@"B"); var c = new DataSource(@"C"); dataSources.Add(a); new Action(() => dataSources.MoveBefore(b, c)).ShouldNotThrow(); dataSources.Should().Equal(a); }
public void TestCtor2() { var settings = new Tailviewer.Settings.DataSources { new DataSource("test1.log") { Id = DataSourceId.CreateNew() }, new DataSource("test2.log") { Id = DataSourceId.CreateNew() }, new DataSource("test.log") { Id = DataSourceId.CreateNew() } }; var merged = new DataSource { Id = DataSourceId.CreateNew() }; settings.Add(merged); settings[0].ParentId = merged.Id; settings[1].ParentId = merged.Id; using (var dataSources = new Tailviewer.BusinessLogic.DataSources.DataSources(_logFileFactory, _scheduler, settings)) { dataSources.Count.Should().Be(4, "Because we've loaded 4 data sources"); var mergedDataSource = dataSources[3] as MergedDataSource; mergedDataSource.Should().NotBeNull(); mergedDataSource.DataSourceCount.Should().Be(2, "Because 2 of the data sources are part of this group"); IDataSource dataSource1 = dataSources[0]; IDataSource dataSource2 = dataSources[1]; mergedDataSource.OriginalSources.Should().Equal(new object[] { dataSource1, dataSource2 }); dataSource1.ParentId.Should().Be(merged.Id); dataSource2.ParentId.Should().Be(merged.Id); } }
public void TestCtor2() { var settings = new Tailviewer.Settings.DataSources { new DataSource("test1.log") { Id = Guid.NewGuid() }, new DataSource("test2.log") { Id = Guid.NewGuid() }, new DataSource("test.log") { Id = Guid.NewGuid() } }; var merged = new DataSource {Id = Guid.NewGuid()}; settings.Add(merged); settings[0].ParentId = merged.Id; settings[1].ParentId = merged.Id; using (var dataSources = new Tailviewer.BusinessLogic.DataSources.DataSources(_scheduler, settings)) { dataSources.Count.Should().Be(4, "Because we've loaded 4 data sources"); var mergedDataSource = dataSources[3] as MergedDataSource; mergedDataSource.Should().NotBeNull(); mergedDataSource.DataSourceCount.Should().Be(2, "Because 2 of the data sources are part of this group"); IDataSource dataSource1 = dataSources[0]; IDataSource dataSource2 = dataSources[1]; mergedDataSource.DataSources.Should().Equal(new object[] {dataSource1, dataSource2}); dataSource1.ParentId.Should().Be(merged.Id); dataSource2.ParentId.Should().Be(merged.Id); } }
public void TestCtor3() { var settings = new Tailviewer.Settings.DataSources { new DataSource("test1.log") { Id = Guid.NewGuid() }, new DataSource("test2.log") { Id = Guid.NewGuid() }, new DataSource("test.log") { Id = Guid.NewGuid() } }; var merged1 = new DataSource {Id = Guid.NewGuid()}; settings.Add(merged1); var merged2 = new DataSource {Id = Guid.NewGuid()}; settings.Add(merged2); var merged3 = new DataSource {Id = Guid.NewGuid()}; settings.Add(merged3); settings[0].ParentId = merged1.Id; settings[1].ParentId = merged2.Id; settings[2].ParentId = merged3.Id; using (var dataSources = new Tailviewer.BusinessLogic.DataSources.DataSources(_scheduler, settings)) { dataSources.Count.Should().Be(6, "Because we've loaded 6 data sources"); var mergedDataSource1 = dataSources[3] as MergedDataSource; mergedDataSource1.Should().NotBeNull(); mergedDataSource1.DataSources.Should().Equal(new object[] {dataSources[0]}); var mergedDataSource2 = dataSources[4] as MergedDataSource; mergedDataSource2.Should().NotBeNull(); mergedDataSource2.DataSources.Should().Equal(new object[] {dataSources[1]}); var mergedDataSource3 = dataSources[5] as MergedDataSource; mergedDataSource3.Should().NotBeNull(); mergedDataSource3.DataSources.Should().Equal(new object[] {dataSources[2]}); } }