public void WhenSetNullConditionThenSetBothConditionToNull() { var hbmFilter = new HbmFilter(); var mapper = new FilterMapper("MyFilter", hbmFilter); mapper.Condition(null); hbmFilter.condition.Should().Be.Null(); hbmFilter.Text.Should().Be.Null(); }
public void WhenSetMultiLineConditionThenSetTextCondition() { var hbmFilter = new HbmFilter(); var mapper = new FilterMapper("MyFilter", hbmFilter); mapper.Condition("aFiled = :aParameter" + Environment.NewLine + "AND anotherField = :anotherParam"); hbmFilter.condition.Should().Be.Null(); hbmFilter.Text.Should().Not.Be.Null(); hbmFilter.Text.Should().Have.SameSequenceAs("aFiled = :aParameter", "AND anotherField = :anotherParam"); }
public void WhenSetEmptyConditionThenSetBothConditionToNull() { var hbmFilter = new HbmFilter(); var mapper = new FilterMapper("MyFilter", hbmFilter); mapper.Condition(string.Empty); hbmFilter.condition.Should().Be.Null(); hbmFilter.Text.Should().Be.Null(); mapper.Condition(" "); hbmFilter.condition.Should().Be.Null(); hbmFilter.Text.Should().Be.Null(); }
public void Filter(string filterName, Action<IFilterMapper> filterMapping) { if (filterMapping == null) { filterMapping = x => { }; } var hbmFilter = new HbmFilter(); var filterMapper = new FilterMapper(filterName, hbmFilter); filterMapping(filterMapper); var filters = mapping.filter != null ? mapping.filter.ToDictionary(f => f.name, f => f) : new Dictionary<string, HbmFilter>(1); filters[filterName] = hbmFilter; mapping.filter = filters.Values.ToArray(); }
public void Filter(string filterName, Action<IFilterMapper> filterMapping) { if (filterMapping == null) { filterMapping = x => { }; } var hbmFilter = new HbmFilter(); var filterMapper = new FilterMapper(filterName, hbmFilter); filterMapping(filterMapper); var filters = classMapping.filter != null ? classMapping.filter.ToDictionary(f => f.name, f => f): new Dictionary<string, HbmFilter>(1); filters[filterName] = hbmFilter; classMapping.filter = filters.Values.ToArray(); }
public void WhenSetSingleLineConditionThenSetSimpleCondition() { var hbmFilter = new HbmFilter(); var mapper = new FilterMapper("MyFilter", hbmFilter); mapper.Condition("aFiled = :aParameter"); hbmFilter.condition.Should().Be("aFiled = :aParameter"); hbmFilter.Text.Should().Be.Null(); }
public void WhenSetSingleLineConditionThenResetTextCondition() { var hbmFilter = new HbmFilter(); var mapper = new FilterMapper("MyFilter", hbmFilter); mapper.Condition("aFiled = :aParameter" + Environment.NewLine + "AND anotherField = :anotherParam"); mapper.Condition("aFiled = :aParameter"); mapper.Condition("aFiled = :aParameter"); hbmFilter.Text.Should().Be.Null(); }