public void ShouldCombineConditionsUsingBothAndAndOr()
        {
            var builder = new TableQueryFilterBuilder <TestEntity>();

            builder.And(b1 =>
            {
                b1.Property("a").Equals(1);
                b1.Or(b2 =>
                {
                    b2.Property("b").Equals(2);
                    b2.And(b3 =>
                    {
                        b3.Property("c").Equals(3);
                        b3.Not(b4 => b4.Property("d").Equals(4));
                    });
                });
            });
            builder.Build().ShouldBe("(a eq 1) and ((b eq 2) or ((c eq 3) and (not (d eq 4))))");

            builder = new TableQueryFilterBuilder <TestEntity>();
            builder.Or(b1 =>
            {
                b1.Property("a").Equals(1);
                b1.And(b2 =>
                {
                    b2.Property("b").Equals(2);
                    b2.Or(b3 =>
                    {
                        b3.Property("c").Equals(3);
                        b3.Not(b4 => b4.Property("d").Equals(4));
                    });
                });
            });
            builder.Build().ShouldBe("(a eq 1) or ((b eq 2) and ((c eq 3) or (not (d eq 4))))");
        }
        public void ShouldBuildStronglyTypedStringStartsWithFilter()
        {
            var builder = new TableQueryFilterBuilder <TestEntity>();

            builder.Property(x => x.RowKey).StartsWith("abc");
            builder.Build().ShouldBe("(RowKey ge 'abc') and (RowKey lt 'abd')");
        }
        public void ShouldBuildStronglyTypedNotEqualsFilter()
        {
            var builder = new TableQueryFilterBuilder <TestEntity>();

            builder.Property(e => e.RowKey).NotEquals("xyz");
            builder
            .Build()
            .ShouldBe("RowKey ne 'xyz'");
        }
        public void ShouldBuildStronglyTypedBoolFilter()
        {
            var builder = new TableQueryFilterBuilder <TestEntity>();

            builder.Property(e => e.Bool).Equals(true);
            builder
            .Build()
            .ShouldBe("Bool eq true");
        }
        public void ShouldBuildStronglyTypedLessThanFilter()
        {
            var builder = new TableQueryFilterBuilder <TestEntity>();

            builder.Property(e => e.RowKey).LessThan("xyz");
            builder
            .Build()
            .ShouldBe("RowKey lt 'xyz'");
        }
        public void ShouldBuildStronglyTypedLongFilter()
        {
            var value       = long.MaxValue;
            var valueString = $"{value}L";

            var builder = new TableQueryFilterBuilder <TestEntity>();

            builder.Property(e => e.Long).Equals(value);
            builder
            .Build()
            .ShouldBe($"Long eq {valueString}");
        }
        public void ShouldBuildStronglyTypedIntFilter()
        {
            var value       = int.MaxValue;
            var valueString = value.ToString();

            var builder = new TableQueryFilterBuilder <TestEntity>();

            builder.Property(e => e.Int).Equals(value);
            builder
            .Build()
            .ShouldBe($"Int eq {valueString}");
        }
        public void ShouldBuildStronglyTypedGuidFilter()
        {
            var value       = Guid.NewGuid();
            var valueString = $"guid'{value}'";

            var builder = new TableQueryFilterBuilder <TestEntity>();

            builder.Property(e => e.Guid).Equals(value);
            builder
            .Build()
            .ShouldBe($"Guid eq {valueString}");
        }
        public void ShouldBuildStronglyTypedDoubleFilter()
        {
            var value       = double.MaxValue;
            var valueString = value.ToString(CultureInfo.InvariantCulture);

            var builder = new TableQueryFilterBuilder <TestEntity>();

            builder.Property(e => e.Double).Equals(value);
            builder
            .Build()
            .ShouldBe($"Double eq {valueString}");
        }
        public void ShouldBuildStronglyTypedDateFilter()
        {
            var value       = DateTimeOffset.Now;
            var valueString = $"datetime'{value.ToUniversalTime():yyyy-MM-ddTHH:mm:ss.fffffff}Z'";

            var builder = new TableQueryFilterBuilder <TestEntity>();

            builder.Property(e => e.Date).Equals(value);
            builder
            .Build()
            .ShouldBe($"Date eq {valueString}");
        }
        public void ShouldBuildStronglyTypedBytesFilter()
        {
            var value       = new byte[] { 0, 1, 2, 4, 8, 16, 32, 64, 128, 255 };
            var valueString = $"X'{string.Join("", value.Select(x => $"{x:x2}"))}'";

            var builder = new TableQueryFilterBuilder <TestEntity>();

            builder.Property(e => e.Bytes).Equals(value);
            builder
            .Build()
            .ShouldBe($"Bytes eq {valueString}");
        }
        public void ShouldBuildFilter(string operation, object value, string expected)
        {
            var builder = new TableQueryFilterBuilder <TestEntity>();

            var conditionBuilder = builder.Property("Fake");
            var method           = conditionBuilder.GetType().GetMethod(operation, new[] { value.GetType() });

            method.Invoke(conditionBuilder, new object[] { value });

            builder
            .Build()
            .ShouldBe($"Fake {expected}");
        }
        public void ShouldCombineConditionsWithOr()
        {
            var builder = new TableQueryFilterBuilder <TestEntity>();

            builder.Or(x => x.Property("a").Equals(1));
            builder.Build().ShouldBe("a eq 1");

            builder = new TableQueryFilterBuilder <TestEntity>();
            builder.Or(x =>
            {
                x.Property("a").Equals(1);
                x.Property("b").Equals(2);
            });
            builder.Build().ShouldBe("(a eq 1) or (b eq 2)");

            builder = new TableQueryFilterBuilder <TestEntity>();
            builder.Or(x =>
            {
                x.Property("a").Equals(1);
                x.Property("b").Equals(2);
            });
            builder.Build().ShouldBe("(a eq 1) or (b eq 2)");

            builder = new TableQueryFilterBuilder <TestEntity>();
            builder.Or(x =>
            {
                x.Property("a").Equals(1);
                x.Property("b").Equals(2);
                x.Property("c").Equals(3);
            });
            builder.Build().ShouldBe("((a eq 1) or (b eq 2)) or (c eq 3)");


            builder = new TableQueryFilterBuilder <TestEntity>();
            builder.Or(x =>
            {
                x.Property("a").Equals(1);
                x.Property("b").Equals(2);
                x.Property("c").Equals(3);
            });
            builder.Build().ShouldBe("((a eq 1) or (b eq 2)) or (c eq 3)");
        }