Beispiel #1
0
        public async void CourierService_GetCouriersAsync_should_return_courier_dtos()
        {
            // Arrange
            var fakeCouriers = A.ListOf <Courier>(3);
            var fakeDtos     = A.ListOf <CourierDto>(3);

            _repository.Setup(x => x.GetCouriersAsync()).ReturnsAsync(fakeCouriers);
            _mapper.Setup(x => x.Map <List <CourierDto> >(fakeCouriers)).Returns(fakeDtos);

            // Act
            var courierDtos = await _service.GetCouriersAsync();

            // Assert
            _repository.Verify(x => x.GetCouriersAsync(), Times.Once());
            _mapper.Verify(x => x.Map <List <CourierDto> >(fakeCouriers), Times.Once());
            courierDtos.Count().Should().Be(3);
        }