public void TypesShouldMatchForIndexAsync() { //Arrange var questionnaireController = new QuestionnaireController(); //Act var responseType = questionnaireController.IndexAsync().Result.ViewData.Model.GetType().Name; //Assert -Check if return type is correct responseType.Should().Be("QuestionnaireViewModel"); }
public void ShouldGetQuestionsAsync() { //Arrange var questionnaireController = new QuestionnaireController(); //Act var responseModel = (QuestionnaireViewModel)questionnaireController.IndexAsync().Result.ViewData.Model; //Assert -Check if return type is correct responseModel.Questions.Should().NotBeNullOrEmpty(); }
public void IndexAsyncShouldHaveFourQuestionsAndOneTitle() { //Arrange var questionnaireController = new QuestionnaireController(); //Act var returnedModel = (QuestionnaireViewModel)questionnaireController.IndexAsync().Result.ViewData.Model; //Assert -Check if return type is correct returnedModel.Questions.Should().NotBeNullOrEmpty(); returnedModel.Questions.Count.ShouldBeEquivalentTo(4); returnedModel.QuestionnaireTitle.Should().NotBeNull(); returnedModel.QuestionnaireTitle.Should().NotBeEmpty(); //this would fail if it was a list so title is only one entity returnedModel.QuestionnaireTitle.Should().BeOfType <string>(); }