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

54 lines
1.7 KiB
C#

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
{
public static async Task<(bool, IEnumerable<Surveys.Models.Survey>, string)> getOkResponse()
{
IEnumerable<Surveys.Models.Survey> list = new List<Surveys.Models.Survey>();
for (int i = 0; i < 10; i++)
{
list.Append(new Surveys.Models.Survey { Id = i, /*Title = "Survey Title - " + i */});
}
return (true, list, null);
}
public static async Task<(bool, Surveys.Models.Survey, string)> getOkResponse( int Id)
{
var surveys = await getOkResponse();
var survey = surveys.Item2.FirstOrDefault(s => s.Id == Id);
return (true, survey, null);
}
public static async Task<(bool, Surveys.Models.Survey, string)> getBadRequestResponse()
{
return (false, null,"Bad Request");
}
public static async Task<(bool, Surveys.Models.Survey, string)> getNotFoundResponse()
{
return (false, null, "Not Found");
}
public static async Task<(bool, IEnumerable<Surveys.Models.Survey>, string)> getNoContentResponse()
{
IEnumerable<Surveys.Models.Survey> list = new List<Surveys.Models.Survey>();
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) };
}
}
}