Пример #1
0
        public async Task FindByIdAndMerchantId_WhenTransactionDoesntExistsForMerchant_ShouldReturnNull(
            Guid transactionId, Guid merchantId, Transaction transaction, TransactionFinder sut)
        {
            transaction = null;
            sut.TransactionRepository.FindByIdAndMerchantIdAsync(
                Arg.Is(transactionId), Arg.Is(merchantId)).Returns(transaction);

            var result = await sut.FindByIdAndMerchantIdAsync(transactionId, merchantId);

            result.Should().BeNull();
        }
Пример #2
0
        public async Task FindByIdAndMerchantId_WhenTransactionExistsForMerchant_ShouldReturnTransactionDto(
            Guid transactionId, Guid merchantId, Transaction transaction, TransactionFinder sut)
        {
            sut.TransactionRepository.FindByIdAndMerchantIdAsync(
                Arg.Is(transactionId), Arg.Is(merchantId)).Returns(transaction);

            var result = await sut.FindByIdAndMerchantIdAsync(transactionId, merchantId);

            result.Should().NotBeNull();
            result.Should().BeOfType(typeof(TransactionDto));
            result.Should().BeEquivalentTo(transaction.ConvertToTransactionDto());
        }