Exemplo n.º 1
0
        public void CreateAsync_WhenModelIsValid_ReturnsOk()
        {
            var response = _controller.CreateAsync(new App.Models.Survey
            {
                Name = _surveyName
            }).Result;

            _surveyService.Verify(repo => repo.CreateNewSurvey(It.IsAny <App.Models.Survey>()), Times.Exactly(1));
            Assert.IsType <CreatedAtActionResult>(response);

            Assert.NotNull(response);

            var survey = ((CreatedAtActionResult)response).Value as App.Models.Survey;

            Assert.NotNull(survey);
            Assert.Equal(survey.Id, _matchingGuid);
        }