public void TestAddQuickFilter() { _settings.Should().BeEmpty(); var quickFilters = new Tailviewer.BusinessLogic.Filters.QuickFilters(_settings); var quickFilter = quickFilters.AddQuickFilter(); _settings.Should().HaveCount(1); quickFilter.Value = "foobar"; _settings[0].Value.Should().Be("foobar"); }
public void TestStoreRestore() { using (var stream = new MemoryStream()) { using (var writer = XmlWriter.Create(stream)) { writer.WriteStartElement("Test"); var settings = new QuickFilters { TimeFilter = { SpecialInterval = SpecialDateTimeInterval.ThisWeek } }; settings.Add(new QuickFilter { Value = "42" }); settings.Save(writer); writer.WriteEndElement(); } stream.Position = 0; //Console.WriteLine(Encoding.UTF8.GetString(stream.ToArray())); using (var reader = XmlReader.Create(stream)) { reader.MoveToContent(); var settings = new QuickFilters(); settings.Restore(reader); settings.TimeFilter.SpecialInterval.Should().Be(SpecialDateTimeInterval.ThisWeek); settings.Should().HaveCount(1); settings[0].Value.Should().Be("42"); } } }
public void TestConstruction() { var filters = new QuickFilters(); filters.Should().BeEmpty(); filters.TimeFilter.Should().NotBeNull(); filters.TimeFilter.Mode.Should().Be(TimeFilterMode.Everything); filters.TimeFilter.Minimum.Should().BeNull(); filters.TimeFilter.Maximum.Should().BeNull(); }