Exemple #1
0
        public void TestCreateChildrenShouldNotCreateNullLeafIfColumnHasNoNulls()
        {
            var column = new ColumnBuilder()
                         .WithValue(DateTime.MinValue)
                         .WithValue(DateTime.MinValue)
                         .Build();
            var root   = new DateTimeFilterTreeRoot(string.Empty, column);
            var result = root.CreateChildren();

            Assert.That(result.Count(), Is.EqualTo(0));
        }
Exemple #2
0
        public void TestCreateFilterShouldCreateDateTimeFilterIfColumnDoesNotHasNulls()
        {
            var column = new ColumnBuilder()
                         .WithValue(DateTime.MinValue)
                         .WithValue(DateTime.MaxValue)
                         .Build();
            var root   = new DateTimeFilterTreeRoot(string.Empty, column);
            var result = root.CreateFilter();

            Assert.That(result is DateTimeFilter);
        }
Exemple #3
0
        private void Test(DateTime lower, DateTime upper, int index, string name)
        {
            var column = new ColumnBuilder()
                         .WithValue(lower)
                         .WithValue(upper)
                         .Build();
            var root   = new DateTimeFilterTreeRoot(string.Empty, column);
            var result = root.CreateChildren();

            Assert.That(result.ElementAt(index).Name, Is.EqualTo(name));
            //TODO: Assert value
        }
Exemple #4
0
        public void TestCreateChildrenShouldCreateNullLeafIfColumnHasNulls()
        {
            var column = new ColumnBuilder()
                         .WithValue(DateTime.MinValue)
                         .WithValue(DateTime.MinValue)
                         .WithNulls()
                         .Build();
            var root   = new DateTimeFilterTreeRoot(string.Empty, column);
            var result = root.CreateChildren();

            Assert.That(result.Single() is NullFilterTreeLeaf);
        }
Exemple #5
0
        public void TestCreateChildrenShouldCreateChildren(string span, Type type)
        {
            var timeSpan = TimeSpan.Parse(span);
            var column   = new ColumnBuilder()
                           .WithValue(DateTime.MinValue)
                           .WithValue(DateTime.MinValue + timeSpan)
                           .Build();
            var root   = new DateTimeFilterTreeRoot(string.Empty, column);
            var result = root.CreateChildren();

            Assert.That(result.First(), Is.TypeOf(type));
        }
Exemple #6
0
        public void TestCreateFilterShouldCreateNullableDateTimeFilterIfColumnHasNulls()
        {
            var column = new ColumnBuilder()
                         .WithValue(DateTime.MinValue)
                         .WithValue(DateTime.MaxValue)
                         .WithNulls().Build();
            var root   = new DateTimeFilterTreeRoot(string.Empty, column);
            var result = (DateTimeFilter)root.CreateFilter();

            Assert.That(result.LowerValue, Is.EqualTo(DateTime.MinValue));
            Assert.That(result.UpperValue, Is.EqualTo(DateTime.MaxValue));
            Assert.That(result.IncludeNull, Is.True);
        }