2023-08-15 22:52:30 -05:00
|
|
|
|
using System.Text;
|
|
|
|
|
namespace DamageAssesment.Api.Locations.Test
|
|
|
|
|
{
|
|
|
|
|
public class MockData
|
|
|
|
|
{
|
|
|
|
|
public static async Task<(bool, IEnumerable<Locations.Models.Region>, string)> getOkResponse()
|
|
|
|
|
{
|
|
|
|
|
IEnumerable<Locations.Models.Region> list = new List<Locations.Models.Region>();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
|
{
|
|
|
|
|
list.Append(new Locations.Models.Region { Id = "R" + i, Abbreviation = "AB" + i, Name = "Region " + i });
|
|
|
|
|
}
|
|
|
|
|
return (true, list, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static async Task<(bool, Locations.Models.Region, string)> getOkResponse(string Id)
|
|
|
|
|
{
|
2023-08-31 00:57:14 -05:00
|
|
|
|
var regions = await getOkResponse();
|
|
|
|
|
var region = regions.Item2.FirstOrDefault(s => s.Id == Id);
|
|
|
|
|
return (true, region, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static async Task<(bool, IEnumerable<Models.Location>, string)> getOkResponseLocation()
|
|
|
|
|
{
|
|
|
|
|
IEnumerable<Locations.Models.Location> list = new List<Models.Location>();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
|
{
|
|
|
|
|
list.Append(new Locations.Models.Location { Id = "Loc"+ i, RegionId = "R"+i, Name ="Location"});
|
|
|
|
|
}
|
|
|
|
|
return (true, list, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static async Task<(bool, IEnumerable<Models.Location>, string)> getNotFoundResponseLocation()
|
|
|
|
|
{
|
|
|
|
|
return (false, null, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static async Task<(bool, Models.Location, string)> getOkResponseLocation(string Id)
|
|
|
|
|
{
|
|
|
|
|
var locations = await getOkResponseLocation();
|
|
|
|
|
var location = locations.Item2.FirstOrDefault(s => s.Id == Id);
|
|
|
|
|
return (true, location, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static async Task<(bool, string)> getLocation(bool value,string message)
|
|
|
|
|
{
|
|
|
|
|
return (value,message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static async Task<(bool, Locations.Models.Location, string)> getLocationNotFoundResponse()
|
|
|
|
|
{
|
|
|
|
|
return (false, null, "Not Found");
|
2023-08-15 22:52:30 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static async Task<(bool, Locations.Models.Region, string)> getBadRequestResponse()
|
|
|
|
|
{
|
|
|
|
|
return (false, null, "Bad Request");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static async Task<(bool, Locations.Models.Region, string)> getNotFoundResponse()
|
|
|
|
|
{
|
|
|
|
|
return (false, null, "Not Found");
|
|
|
|
|
}
|
|
|
|
|
public static async Task<(bool, IEnumerable<Locations.Models.Region>, string)> getNoContentResponse()
|
|
|
|
|
{
|
|
|
|
|
IEnumerable<Locations.Models.Region> list = new List<Locations.Models.Region>();
|
|
|
|
|
return (false, list, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static async Task<Locations.Models.Region> getInputRegionData()
|
|
|
|
|
{
|
|
|
|
|
return new Locations.Models.Region { Id = "R99", Name = "Region 99", Abbreviation = "A99" };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|