コード例 #1
0
        public void ShouldGetClientOperations()
        {
            // Arrange
            int testClientId = 2;
            int number       = 4;

            reportsService = new ReportsService(
                operationTableRepository: this.operationTableRepository,
                sharesNumberTableRepository: this.sharesNumberTableRepository,
                balanceTableRepository: this.balanceTableRepository,
                shareTableRepository: this.shareTableRepository,
                clientTableRepository: this.clientTableRepository);


            // Act
            List <OperationEntity> operationsOfClient = new List <OperationEntity>();

            operationsOfClient.AddRange(reportsService.GetOperationByClient(testClientId, number));

            // Assert
            this.operationTableRepository.Received(1).GetByClient(testClientId, number);
            for (int i = 0; i < number; i++)
            {
                if (operationsOfClient[i].Customer.Id != testClientId)
                {
                    throw new ArgumentException("Wrong Id in result item");
                }
            }
        }
コード例 #2
0
        public void ShouldGetClientOperations()
        {
            // Arrange
            reportsService = new ReportsService(
                operationTableRepository: this.operationTableRepository,
                sharesNumberTableRepository: this.sharesNumberTableRepository,
                balanceTableRepository: this.balanceTableRepository,
                shareTableRepository: this.shareTableRepository,
                clientTableRepository: this.clientTableRepository);
            int testClientId = 5;

            // Act
            var operationsOfClient = reportsService.GetOperationByClient(testClientId);

            // Assert
            this.operationTableRepository.Received(1).GetByClient(testClientId);
            foreach (var testOperation in operationsOfClient)
            {
                if (testOperation.Customer.Id != testClientId)
                {
                    throw new ArgumentException("Wrong Id in result item");
                }
            }
        }