public ActionResult Reject(RejectOfferCommand command)
        {
            var handler = new RejectOfferCommandHandler(_context);

            handler.Handle(command);

            return(RedirectToAction("OnProperty", new { id = command.PropertyId }));
        }
        public void HandleShouldAcceptOffer()
        {
            // Arrange
            var command = new RejectOfferCommand
            {
                PropertyId = 1,
                OfferId    = 1
            };

            // Act
            _handler.Handle(command);

            // Assert
            var offer = _context.Offers.First();

            Assert.That(offer.Status, Is.EqualTo(OfferStatus.Rejected));
        }
        public void OfferIsRejected()
        {
            // Arrange
            var command = new RejectOfferCommand
            {
                PropertyId = 1,
                OfferId    = 2
            };

            // Act
            _handler.Handle(command);

            // Assert
            _context.Received(1).SaveChanges();

            Assert.True(_context.Offers.Count(o => o.Status == OfferStatus.Rejected) == 1);

            var offer = _context.Offers.FirstOrDefault(o => o.Id == 2);

            Assert.True(offer.Status == OfferStatus.Rejected);
        }