public static IValueProvider ValueProvider(TicketSpecification spec)
 {
     return(new SimpleValueProvider()
     {
         { "Title", spec.Title },
         { "TicketTypeId", spec.TicketTypeId },
         { "IncludeClosed", spec.IncludeClosed }
     });
 }
Example #2
0
 public IPagedList <TicketSearchResult> SearchTickets(TicketSpecification specification, int?pageIndex, int?pageSize)
 {
     return(WithValid(specification, () =>
     {
         var result = ticketRepository.RetrieveMultiple(specification, pageIndex, pageSize, ticketPagingSettings);
         result.ForEach(t => t.TicketType = TicketTypeMap[t.TicketTypeId]);
         return result;
     }));
 }
Example #3
0
        public NameValueCollection Search(TicketSpecification specification)
        {
            var page = Browser.Page <TicketsSearchPage>();

            return(page.Container
                   .Fill(specification)
                   .Submit()
                   .OnErrorMessage(m => { throw new InvalidOperationException(m); })
                   .ValidationErrors());
        }
Example #4
0
        public ActionResult List(int?pageIndex, int?pageSize)
        {
            var model = new TicketSpecification();

            if (!TryUpdateModel(model))
            {
                return(new BadRequestResult());
            }

            return(List(model, pageIndex, pageSize));
        }
        public void RetrieveMultiple(TicketSpecification spec)
        {
            // Arrange
            var req = new RetrieveMultipleRequest <TicketSpecification>(spec)
            {
                PageSize = 50
            };

            // Act
            var result = Repository.RetrieveMultiple(req);

            // Assert
            Assert.NotNull(result);
        }
Example #6
0
        private ActionResult List(TicketSpecification specification, int?pageIndex, int?pageSize)
        {
            var viewData = new TicketListViewData()
            {
                Specification = specification,
                Items         = ticketService.SearchTickets(specification, pageIndex, pageSize)
            };

            if (viewData.Items == null)
            {
                return(new BadRequestResult());
            }

            return(AlternatePartialView("List", viewData));
        }
Example #7
0
 public static void Equal(TicketSpecification expected, TicketSpecification actual)
 {
     Assert.Equal(expected.Title, actual.Title);
     Assert.Equal(expected.TicketTypeId, actual.TicketTypeId);
     Assert.Equal(expected.IncludeClosed, actual.IncludeClosed);
 }