public void BetweenBuilder_Create() { // Arrange var assemblerUnderTest = new BuilderAssembler<BetweenBuilder, BetweenBuilderDTO>(null); var builder = new BetweenBuilder() { Label = "test" }; // Act var restored = assemblerUnderTest.Create(builder); // Assert Assert.IsNotNull(restored); Assert.IsInstanceOf<BetweenBuilderDTO>(restored); var dto = (BetweenBuilderDTO)restored; Assert.AreEqual(builder.Label, dto.Label); }
/// <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); }