public void SeatService_GetSeatByAuditoriumIdRowSeatNum_RepositoryReturnsNull() { //Arrange Seat nullSeat = null; Task <Seat> seat = Task.FromResult(nullSeat); SeatService seatService = new SeatService(_mockSeatsRepository.Object, _mockReservationService.Object); _mockSeatsRepository.Setup(x => x.GetByAuditoriumIdRowColumn(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>())).Returns(seat); //Act var result = seatService.GetSeatByAuditoriumIdRowSeatnum(_seat.AuditoriumId, _seat.Row, _seat.Number).ConfigureAwait(false).GetAwaiter().GetResult(); //Assert Assert.IsNull(result); }
public void SeatService_GetSeatByAuditoriumIdRowSeatNum_ReturnsSeat() { //Arrange Task <Seat> seat = Task.FromResult(_seat); SeatService seatService = new SeatService(_mockSeatsRepository.Object, _mockReservationService.Object); _mockSeatsRepository.Setup(x => x.GetByAuditoriumIdRowColumn(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>())).Returns(seat); // Act var result = seatService.GetSeatByAuditoriumIdRowSeatnum(_seat.AuditoriumId, _seat.Row, _seat.Number).ConfigureAwait(false).GetAwaiter().GetResult(); // Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(SeatDomainModel)); Assert.AreEqual(result.Id, _seat.Id); }