DamageAssessment_Backend/DamageAssesmentApi/DamageAssesment.Api.Surveys.Test/MockData.cs

54 lines
1.8 KiB
C#
Raw Normal View History

2023-08-15 22:52:30 -05:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit.Sdk;
namespace DamageAssesment.Api.Survey.Test
{
public class MockData
{
2023-09-08 14:40:06 -05:00
public static async Task<(bool, IEnumerable<Surveys.Models.MultiLanSurvey>, string)> getOkResponse()
2023-08-15 22:52:30 -05:00
{
2023-09-08 14:40:06 -05:00
IEnumerable<Surveys.Models.MultiLanSurvey> list = new List<Surveys.Models.MultiLanSurvey>();
2023-08-15 22:52:30 -05:00
for (int i = 0; i < 10; i++)
{
2023-09-08 14:40:06 -05:00
list.Append(new Surveys.Models.MultiLanSurvey { Id = i, /*Title = "Survey Title - " + i */});
2023-08-15 22:52:30 -05:00
}
return (true, list, null);
}
2023-09-08 14:40:06 -05:00
public static async Task<(bool, Surveys.Models.MultiLanSurvey, string)> getOkResponse( int Id)
2023-08-15 22:52:30 -05:00
{
var surveys = await getOkResponse();
var survey = surveys.Item2.FirstOrDefault(s => s.Id == Id);
return (true, survey, null);
}
2023-09-08 14:40:06 -05:00
public static async Task<(bool, Surveys.Models.MultiLanSurvey, string)> getBadRequestResponse()
2023-08-15 22:52:30 -05:00
{
return (false, null,"Bad Request");
}
2023-09-08 14:40:06 -05:00
public static async Task<(bool, Surveys.Models.MultiLanSurvey, string)> getNotFoundResponse()
2023-08-15 22:52:30 -05:00
{
return (false, null, "Not Found");
}
2023-09-08 14:40:06 -05:00
public static async Task<(bool, IEnumerable<Surveys.Models.MultiLanSurvey>, string)> getNoContentResponse()
2023-08-15 22:52:30 -05:00
{
2023-09-08 14:40:06 -05:00
IEnumerable<Surveys.Models.MultiLanSurvey> list = new List<Surveys.Models.MultiLanSurvey>();
2023-08-15 22:52:30 -05:00
return (false, list, null);
}
public static async Task<Surveys.Models.Survey> getInputSurveyData()
{
return new Surveys.Models.Survey { Id = 100, /*Title = "Mock survey",*/ IsEnabled= true, StartDate = DateTime.Now, EndDate = DateTime.Now.AddDays(90) };
2023-08-15 22:52:30 -05:00
}
}
}