public BookDeskModelTests()
 {
     _processorMock = new Mock <IDeskBookingRequestProcessor>();
     _bookDeskModel = new BookDeskModel(_processorMock.Object)
     {
         DeskBookingRequest = new DeskBookingRequest()
     };
     _deskBookingResult = new DeskBookingResult
     {
         Code = DeskBookingResultCode.Success
     };
     _processorMock.Setup(x => x.BookDesk(_bookDeskModel.DeskBookingRequest)).Returns(_deskBookingResult);
 }
示例#2
0
        public void ShouldCallBookDeskMethodOfProcessor()
        {
            //Arrange
            var processorMock = new Mock <IDeskBookingRequestProcessor>();

            var bookDeskModel = new BookDeskModel(processorMock.Object)
            {
                DeskBookingRequest = new DeskBookingRequest()
            };

            //Act
            bookDeskModel.OnPost();

            //Assert
            processorMock.Verify(x => x.BookDesk(bookDeskModel.DeskBookingRequest), Times.Once);
        }