Пример #1
0
        public ActionResult Accept(AcceptViewingCommand command)
        {
            var handler = new AcceptViewingCommandHandler(_context);

            handler.Handle(command);

            return(RedirectToAction("OnProperty", new { id = command.PropertyId }));
        }
        public void SetUp()
        {
            _context = Substitute.For <IOrangeBricksContext>();

            var viewings = new List <Models.Viewing> {
                new Viewing {
                    Id = 1, PropertyId = 1, ViewingAt = new DateTime(2017, 1, 1, 9, 0, 0), BuyerUserId = "123", Status = ViewingStatus.Pending
                },
            };

            var mockViewingSet = Substitute.For <IDbSet <Models.Viewing> >()
                                 .Initialize(viewings.AsQueryable());

            _context.Viewings.Returns(mockViewingSet);

            _handler = new AcceptViewingCommandHandler(_context);
        }