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 CreateTransactionTypeDtoValidatorFixture() { Validator = new CreateTransactionTypeDtoValidator(); Model = new CreateTransactionTypeDto { Type = "Food" }; }
public async Task <GetTransactionTypeDto> CreateTransactionTypeAsync(CreateTransactionTypeDto transactionTypeDto) { await CheckTransactionTypeAsync(0, transactionTypeDto.Type); var transactionType = _mapper.Map <TransactionType>(transactionTypeDto); transactionType = await _transactionType.AddTransactionTypeAsync(transactionType); return(_mapper.Map <GetTransactionTypeDto>(transactionType)); }
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> CreateTransactionType(CreateTransactionTypeDto transactionTypeDto, ApiVersion version) { var result = await _repository.CreateTransactionTypeAsync(transactionTypeDto); return(CreatedAtRoute(new { id = result.Id, version = $"{version}" }, result)); }