public void when_rendering_view_then_sets_conference_view_model()
        {
            var dto = new ConferenceAlias();
            this.dao.Setup(x => x.GetConferenceAlias("demo"))
                .Returns(dto);

            var invoker = new Mock<ControllerActionInvoker> { CallBase = true };
            invoker.Protected().Setup("InvokeActionResult", ItExpr.IsAny<ControllerContext>(), ItExpr.IsAny<ActionResult>());

            this.routeData.Values.Add("action", "Display");
            var result = invoker.Object.InvokeAction(this.sut.ControllerContext, "Display");

            Assert.True(result);
            Assert.NotNull((object)this.sut.ViewBag.Conference);
            Assert.Same(dto, this.sut.ViewBag.Conference);
        }
Пример #2
0
 public static PlaceOrder ToPlaceOrderCommand(this OrderViewModel model, ConferenceAlias conferenceAlias, IConferenceQueryService conferenceQueryService)
 {
     var seatTypes = conferenceQueryService.GetPublishedSeatTypes(conferenceAlias.Id);
     var command = new PlaceOrder();
     command.AggregateRootId = GuidUtil.NewSequentialId();
     command.ConferenceId = conferenceAlias.Id;
     command.Seats = model.Seats.Where(x => x.Quantity > 0).Select(x =>
     {
         var seat = seatTypes.Single(y => y.Id == x.SeatType);
         return new SeatInfo
         {
             SeatType = x.SeatType,
             Quantity = x.Quantity,
             SeatName = seat.Name,
             UnitPrice = seat.Price
         };
     }).ToList();
     return command;
 }