public async Task GivenValidInputs_ThenCorrectTransactionsReturned()
            {
                const string expectedUserId = "id123";

                _mockCurrentUserContext.SetupGet(context => context.UserId)
                .Returns(expectedUserId);

                var service = new TransactionHelperService(_mockCurrentUserContext.Object,
                                                           _mockTransactionRepository.Object, _mockMapper.Object);

                var expectedTransactionList = new List <Transaction>()
                {
                    new()
                    {
                        Amount   = decimal.One,
                        Category = "test category123",
                    }
                };

                _mockTransactionRepository
                .Setup(repository => repository.GetTransactions(expectedUserId,
                                                                new DateRange(DateTime.MinValue, DateTime.MaxValue), It.IsAny <ITransactionSpecification>()))
                .ReturnsAsync(() => expectedTransactionList);

                var response = await service.GetTransactionsAsync(new GetTransactionsQuery());

                Assert.Equal(expectedTransactionList, response);
            }
            public async Task GivenQueryInputs_ThenRepositoryCalledWithCorrectSpecification()
            {
                const string expectedUserId          = "id123";
                var          expectedTransactionType = TransactionType.Expense;

                _mockCurrentUserContext.SetupGet(context => context.UserId)
                .Returns(expectedUserId);

                var service = new TransactionHelperService(_mockCurrentUserContext.Object,
                                                           _mockTransactionRepository.Object, _mockMapper.Object);

                ITransactionSpecification calledWithSpecification = null;

                _mockTransactionRepository
                .Setup(repository => repository.GetTransactions(expectedUserId,
                                                                new DateRange(DateTime.MinValue, DateTime.MaxValue), It.IsAny <ITransactionSpecification>()))
                .Callback((string _, DateRange _, ITransactionSpecification transactionSpecification) =>
                {
                    calledWithSpecification = transactionSpecification;
                });

                await service.GetTransactionsAsync(new GetTransactionsQuery
                {
                    Type = expectedTransactionType
                });

                Assert.IsType <AndSpec>(calledWithSpecification);
                Assert.True(calledWithSpecification.IsSatisfied(new Transaction
                {
                    TransactionType = "expense"
                }));
                Assert.False(calledWithSpecification.IsSatisfied(new Transaction
                {
                    TransactionType = "invalid type"
                }));
            }