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

95 lines
4.2 KiB
C#
Raw 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.MultiLanguage>, string)> getOkResponse()
2023-08-15 22:52:30 -05:00
{
IEnumerable<Questions.Models.MultiLanguage> list = new List<Questions.Models.MultiLanguage>();
2023-08-15 22:52:30 -05:00
for (int i = 0; i < 10; i++)
{
list.Append(new Questions.Models.MultiLanguage { 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.MultiLanguage> question = new List<Models.MultiLanguage>();
question.Add(new Models.MultiLanguage { 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,
2023-09-08 14:40:06 -05:00
IconLibrary = "img" + i,
IconName = "Category " + i,
QuestionsText = question
2023-08-15 22:52:30 -05:00
});
}
return (true, list, null);
}
public static async Task<(bool, Questions.Models.MultiLanguage, string)> getOkResponse(int Id)
2023-08-15 22:52:30 -05:00
{
var Questions = await getOkResponse();
var Question = Questions.Item2.FirstOrDefault(s => s.Id == Id);
return (true, Question, null);
}
public static async Task<(bool, Questions.Models.MultiLanguage, string)> getBadRequestResponse()
2023-08-15 22:52:30 -05:00
{
return (false, null, "Bad Request");
}
public static async Task<(bool, Questions.Models.MultiLanguage, string)> getNotFoundResponse()
2023-08-15 22:52:30 -05:00
{
return (false, null, "Not Found");
}
public static async Task<(bool, IEnumerable<Questions.Models.MultiLanguage>, string)> getNoContentResponse()
2023-08-15 22:52:30 -05:00
{
IEnumerable<Questions.Models.MultiLanguage> list = new List<Questions.Models.MultiLanguage>();
2023-08-15 22:52:30 -05:00
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
}
public static async Task<List<Questions.Models.Question>> getInputQuestionsData()
{
Models.QuestionsTranslation QuestionsTranslation = new Models.QuestionsTranslation()
{
Language = "en",
QuestionText = "Sample question"
};
List<Models.QuestionsTranslation> QuestionsTranslations = new List<Models.QuestionsTranslation>();
List<Models.Question> Questions = new List<Models.Question>();
QuestionsTranslations.Add(QuestionsTranslation);
Questions.Models.Question question = new Questions.Models.Question() { Id = 1, Questions = QuestionsTranslations, TypeText = "Text 1", SurveyId = 1, QuestionNumber = 1, IsRequired = true, Comment = false, Key = true, CategoryId = 1 };
Questions.Add(question);
return Questions;
}
2023-08-15 22:52:30 -05:00
}
}