Пример #1
0
        public async Task CreateJsonAsync_Should_Work_Correctly(string username, JsonModel jsonModel, CreateJsonRequestDto createJsonRequestDto)
        {
            _mapper.Map <JsonModel>(createJsonRequestDto).Returns(jsonModel);
            _jsonService.CreateAsync(username, jsonModel).Returns(true);
            var response = await CreateJsonController(username).CreateJsonAsync(createJsonRequestDto);

            var result = response as OkResult;

            Assert.NotNull(result);
        }
Пример #2
0
        public async Task <IActionResult> CreateJsonAsync([FromBody] CreateJsonRequestDto createJsonRequestDto)
        {
            if (await _jsonService.CreateAsync(User.GetUsername(), _mapper.Map <JsonModel>(createJsonRequestDto)))
            {
                return(Ok());
            }

            return(BadRequest());
        }