public void DateSearchDtoGtTest() { var searchRequestDto = new PaginatedSearchRequestDto(100, PaginatedSearchRequestDto.DefaultPaginationOptions); searchRequestDto.SetFromSearchString(_schema, "reportdate".Split(','), ">2013-01-03"); Assert.IsTrue(SearchUtils.GetWhere(searchRequestDto, "SR").Equals("( SR.reportdate > :reportdate_begin )")); var parametersMap = SearchUtils.GetParameters(searchRequestDto); Assert.IsTrue(parametersMap.Count == 1); Assert.IsTrue(parametersMap["reportdate_begin"].Equals(DateUtil.BeginOfDay(DateTime.Parse("2013-01-04")))); }
public void DateSearchDtoGteTest() { var searchRequestDto = new PaginatedSearchRequestDto(100, PaginatedSearchRequestDto.DefaultPaginationOptions); searchRequestDto.SetFromSearchString(_schema, "ticketid,description,asset_.description,siteid,affectedperson,status,reportdate".Split(','), ">=2013-01-01"); Assert.IsTrue(SearchUtils.GetWhere(searchRequestDto, "SR").Equals("( SR.reportdate >= :reportdate_begin )")); var parametersMap = SearchUtils.GetParameters(searchRequestDto); Assert.IsTrue(parametersMap.Count == 1); Assert.IsTrue(parametersMap["reportdate_begin"].Equals(DateUtil.BeginOfDay(DateTime.Parse("2013-01-01")))); }
public void DateTimeSearchDtoLteTest() { var searchRequestDto = new PaginatedSearchRequestDto(100, PaginatedSearchRequestDto.DefaultPaginationOptions); searchRequestDto.SetFromSearchString(_schema, "reportdate".Split(','), "<=2013-01-01 15:45"); Assert.IsTrue(SearchUtils.GetWhere(searchRequestDto, "SR").Equals("( SR.reportdate <= :reportdate_end )")); var parametersMap = SearchUtils.GetParameters(searchRequestDto); Assert.IsTrue(parametersMap.Count == 1); Assert.AreEqual(DateTime.Parse("2013-01-01 15:45:59.999"), parametersMap["reportdate_end"]); }
public void NumberSearchDtoGteTest() { var searchRequestDto = new PaginatedSearchRequestDto(100, PaginatedSearchRequestDto.DefaultPaginationOptions); searchRequestDto.SetFromSearchString(_schema, "curbal".Split(','), ">=20"); Assert.AreEqual("( invbalances.curbal >= :curbal )", SearchUtils.GetWhere(searchRequestDto, "invbalances")); var parametersMap = SearchUtils.GetParameters(searchRequestDto); Assert.IsTrue(parametersMap.Count == 1); Assert.IsTrue(parametersMap["curbal"].Equals(20)); }
public void DateTimeSearchDtoNeqTest() { var searchRequestDto = new PaginatedSearchRequestDto(100, PaginatedSearchRequestDto.DefaultPaginationOptions); searchRequestDto.SetFromSearchString(_schema, "reportdate".Split(','), "!=2013-01-04"); var @where = SearchUtils.GetWhere(searchRequestDto, "SR"); Assert.AreEqual("( SR.reportdate NOT BETWEEN :reportdate_begin AND :reportdate_end OR SR.reportdate IS NULL )", @where); var parametersMap = SearchUtils.GetParameters(searchRequestDto); Assert.IsTrue(parametersMap.Count == 2); Assert.AreEqual(DateUtil.BeginOfDay(DateTime.Parse("2013-01-04")), parametersMap["reportdate_begin"]); Assert.AreEqual(DateUtil.EndOfDay(DateTime.Parse("2013-01-04")), parametersMap["reportdate_end"]); }
public void DateSearchDtoTest() { var searchRequestDto = new PaginatedSearchRequestDto(100, PaginatedSearchRequestDto.DefaultPaginationOptions); searchRequestDto.SetFromSearchString(_schema, "ticketid,description,asset_.description,siteid,affectedperson,status,reportdate".Split(','), "2013-01-01"); Assert.IsNotNull(searchRequestDto); Assert.IsTrue(searchRequestDto.SearchParams.Equals("reportdate")); Assert.IsTrue(searchRequestDto.SearchValues.Equals("2013-01-01")); String whereClause = SearchUtils.GetWhere(searchRequestDto, "SR"); Assert.IsTrue(whereClause.Equals("( SR.reportdate BETWEEN :reportdate_begin AND :reportdate_end )")); IDictionary <String, Object> parametersMap = SearchUtils.GetParameters(searchRequestDto); Assert.IsTrue(parametersMap.Count == 2); Assert.IsTrue(parametersMap["reportdate_begin"].Equals(DateUtil.BeginOfDay(DateTime.Parse("2013-01-01")))); Assert.IsTrue(parametersMap["reportdate_end"].Equals(DateUtil.EndOfDay(DateTime.Parse("2013-01-01")))); }