DamageAssessment_Backend/DamageAssesmentApi/DamageAssesment.Api.QuestionsTest/MockData.cs

83 lines
3.3 KiB
C#
Raw Permalink Normal View History

2023-08-25 10:36:31 -05:00
using System.Text;
2023-08-15 22:52:30 -05:00
namespace DamageAssesment.Api.Questions.Test
{
public class MockData
{
public static async Task<(bool, IEnumerable<Questions.Models.Question>, string)> getOkResponse()
{
IEnumerable<Questions.Models.Question> list = new List<Questions.Models.Question>();
for (int i = 0; i < 10; i++)
{
list.Append(new Questions.Models.Question { Id = i, TypeText = "Text" + i, SurveyId = 1, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId=i });
2023-08-15 22:52:30 -05:00
}
return (true, list, null);
}
public static async Task<(bool, List<Questions.Models.SurveyQuestions>, string)> getOkSurveyResponse()
{
List<Questions.Models.SurveyQuestions> list = new List<Questions.Models.SurveyQuestions>();
for (int i = 0; i < 10; i++)
{
List<Models.Question> question = new List<Models.Question>();
2023-08-25 10:36:31 -05:00
question.Add(new Models.Question { Id = i, TypeText = "Text" + i, SurveyId = 1, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = i });
2023-08-15 22:52:30 -05:00
list.Append(new Questions.Models.SurveyQuestions
{
CategoryId = i,
CategoryImage = "img" + i,
CategoryName = "Category " + i,
Questions = question
});
}
return (true, list, null);
}
public static async Task<(bool, Questions.Models.Question, string)> getOkResponse(int Id)
{
var Questions = await getOkResponse();
var Question = Questions.Item2.FirstOrDefault(s => s.Id == Id);
return (true, Question, null);
}
public static async Task<(bool, Questions.Models.Question, string)> getBadRequestResponse()
{
return (false, null, "Bad Request");
}
public static async Task<(bool, Questions.Models.Question, string)> getNotFoundResponse()
{
return (false, null, "Not Found");
}
public static async Task<(bool, IEnumerable<Questions.Models.Question>, string)> getNoContentResponse()
{
IEnumerable<Questions.Models.Question> list = new List<Questions.Models.Question>();
return (false, list, null);
}
public static async Task<(bool, List<Questions.Models.SurveyQuestions>, string)> getNoSurveyContentResponse()
{
List<Questions.Models.SurveyQuestions> list = new List<Questions.Models.SurveyQuestions>();
return (false, list, null);
}
public static async Task<Questions.Models.Question> getInputQuestionData()
{
Models.QuestionsTranslation QuestionsTranslation = new Models.QuestionsTranslation()
{
Language = "en",
QuestionText = "Sample question"
};
List<Models.QuestionsTranslation> QuestionsTranslations = new List<Models.QuestionsTranslation>();
QuestionsTranslations.Add(QuestionsTranslation);
return new Questions.Models.Question { Id = 1, Questions=QuestionsTranslations, TypeText = "Text 1", SurveyId = 1, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId=1};
2023-08-15 22:52:30 -05:00
}
}
}