Exemplo n.º 1
0
        public async Task FindAllByMerchantId_WhenMerchantHasntTransactions_ShouldReturnNull(
            Guid merchantId, List <Transaction> transactions, TransactionFinder sut)
        {
            transactions = new List <Transaction>();
            sut.TransactionRepository.FindAllByMerchantIdAsync(Arg.Is(merchantId)).Returns(transactions);

            var result = await sut.FindAllByMerchantIdAsync(merchantId);

            result.Should().BeNull();
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
0
        public async Task FindAllByMerchantId_WhenMerchantHasTransactions_ShouldReturnTransactionDtoList(
            Guid merchantId, List <Transaction> transactions, TransactionFinder sut)
        {
            sut.TransactionRepository.FindAllByMerchantIdAsync(
                Arg.Is(merchantId)).Returns(transactions);

            var result = await sut.FindAllByMerchantIdAsync(merchantId);

            result.Should().NotBeNullOrEmpty();
            result.Should().BeOfType(typeof(List <TransactionDto>));
        }
Exemplo n.º 4
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());
        }