public async Task Flipping_A_Null_Or_Empty_Sentence_Should_Not_Persist_It(string sentence)
        {
            /////////////
            // ARRANGE
            /////



            /////////////
            // ACT
            /////

            var flippedSentence = await _flipSentenceService.Flip(sentence);


            /////////////
            // ASSERT
            /////

            Assert.Null(flippedSentence);

            A.CallTo(() => _flippedSentenceRepository.Add(A <FlippedSentence> ._)).MustNotHaveHappened();
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Flip(FlipRequestDto request)
        {
            FlippedSentenceDto flippedSentence = null;


            if (request != null)
            {
                flippedSentence = FlippedSentenceDto.Convert(await _flipSentenceService.Flip(request.OriginalSentence));
            }


            if (flippedSentence == null)
            {
                return(this.RespondWithJsonError(HttpStatusCode.BadRequest, "'originalSentence' cannot be null or empty."));
            }


            return(new ObjectResult(flippedSentence));
        }