Beispiel #1
0
        public void TableParameters_AddRemoveFilters_ThrowsSpecifyingNull()
        {
            var parameters = new SensorParameters();

            AssertEx.Throws <ArgumentNullException>(() => parameters.AddFilters(null), $"Value cannot be null.{Environment.NewLine}Parameter name: filters");
            AssertEx.Throws <ArgumentNullException>(() => parameters.RemoveFilters(null), $"Value cannot be null.{Environment.NewLine}Parameter name: filters");
        }
Beispiel #2
0
        public void TableParameters_AddsAndRemovesFilters()
        {
            var parameters = new SensorParameters();

            Assert.AreEqual(false, parameters.RemoveFilters(new SearchFilter(Property.Comments, "hello")));
            var filter1 = new SearchFilter(Property.Id, 1234);

            parameters.AddFilters(filter1);
            Assert.AreEqual(1, parameters.SearchFilters.Count);

            var filters2_3 = new[] { new SearchFilter(Property.Id, 4567), new SearchFilter(Property.Type, "ping") };

            parameters.AddFilters(filters2_3);
            Assert.AreEqual(3, parameters.SearchFilters.Count);

            parameters.RemoveFilters(filters2_3);
            Assert.AreEqual(1, parameters.SearchFilters.Count);
            Assert.AreEqual(filter1, parameters.SearchFilters.Single());
        }