Пример #1
0
        /// <summary>
        /// Creates a builder that can be used as a default for a field path.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public virtual ParameterBuilder GetDefault(IFieldPath path)
        {
            ParameterBuilder b;
            if (path.Last.DataType == typeof(string))
                b = new LikeBuilder(MatchMode.Anywhere);
            else if (path.Last.DataType == typeof(DateTime))
                b = new DateBetweenBuilder();
            else if (IsNumeric(path.Last.DataType))
                b = new BetweenBuilder();
            else
                b = new SimpleBuilder("=");

            return new JunctionBuilder(JunctionType.Disjunction, b);
        }
Пример #2
0
        public void SimpleBuilder_Create()
        {
            // Arrange
            var assemblerUnderTest = new SimpleBuilderAssembler(null);
            var builder = new SimpleBuilder()
            {
                Label = "test",
                Operator = "="
            };

            // Act
            var restored = assemblerUnderTest.Create(builder);

            // Assert
            Assert.IsNotNull(restored);
            Assert.IsInstanceOf<SimpleBuilderDTO>(restored);
            var dto = (SimpleBuilderDTO)restored;
            Assert.AreEqual(builder.Label, dto.Label);
            Assert.AreEqual(builder.Operator, dto.Operator);
        }