public TransactionTypeRepositoryFixture()
        {
            MockTransactionTypeService = new Mock <ITransactionTypeService>();

            TransactionTypes = new List <TransactionType>
            {
                new TransactionType {
                    Id = 1, Type = "Food"
                },
                new TransactionType {
                    Id = 2, Type = "Transportation"
                },
                new TransactionType {
                    Id = 3, Type = "Shopping"
                },
                new TransactionType {
                    Id = 4, Type = "Mortgage"
                },
                new TransactionType {
                    Id = 5, Type = "Extra Income"
                }
            };

            CreateTransactionTypeDto = new CreateTransactionTypeDto {
                Type = "Utilities"
            };
            CreatedNewTransactionType = new TransactionType {
                Id = 6, Type = CreateTransactionTypeDto.Type
            };
            EditTransactionTypeDto = new EditTransactionTypeDto {
                Type = "Mortgage/Rent"
            };
        }
        public EditTransactionTypeDtoValidatorFixture()
        {
            Validator = new EditTransactionTypeDtoValidator();

            Model = new EditTransactionTypeDto
            {
                Type = "Rent"
            };
        }
示例#3
0
        public async Task <GetTransactionTypeDto> UpdateTransactionTypeAsync(int id, EditTransactionTypeDto transactionTypeDto)
        {
            var transactionType = await GetTransactionTypeById(id);

            await CheckTransactionTypeAsync(id, transactionTypeDto.Type);

            transactionType = _mapper.Map(transactionTypeDto, transactionType);

            await _transactionType.UpdateTransactionTypeAsync(transactionType);

            return(_mapper.Map <GetTransactionTypeDto>(transactionType));
        }
示例#4
0
        public TransactionTypeControllerFixture()
        {
            ApiVersion = new ApiVersion(1, 0);

            MockTransactionTypeRepository = new Mock <ITransactionTypeRepository>();

            TransactionTypes = new List <GetTransactionTypeDto>
            {
                new GetTransactionTypeDto {
                    Id = 1, Type = "Food"
                },
                new GetTransactionTypeDto {
                    Id = 2, Type = "Extra Income"
                },
                new GetTransactionTypeDto {
                    Id = 3, Type = "Mortgage"
                }
            };

            ValidCreateTransactionTypeDto = new CreateTransactionTypeDto
            {
                Type = "Salary"
            };

            CreateTransactionTypeDtoResult = new GetTransactionTypeDto
            {
                Id   = 4,
                Type = "Salary"
            };

            ValidEditTransactionTypeDto = new EditTransactionTypeDto
            {
                Type = "Mortgage/Rent"
            };

            EditTransactionTypeDtoResult = new GetTransactionTypeDto
            {
                Id   = 3,
                Type = "Mortgage/Rent"
            };
        }
        public async Task <IActionResult> UpdateTransactionType(int id, EditTransactionTypeDto transactionTypeDto)
        {
            var result = await _repository.UpdateTransactionTypeAsync(id, transactionTypeDto);

            return(Ok(result));
        }