forked from MDCPS/DamageAssessment_Backend
Test project for location service updated
This commit is contained in:
@ -17,9 +17,43 @@ namespace DamageAssesment.Api.Locations.Test
|
||||
|
||||
public static async Task<(bool, Locations.Models.Region, string)> getOkResponse(string Id)
|
||||
{
|
||||
var surveys = await getOkResponse();
|
||||
var survey = surveys.Item2.FirstOrDefault(s => s.Id == Id);
|
||||
return (true, survey, null);
|
||||
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");
|
||||
}
|
||||
|
||||
public static async Task<(bool, Locations.Models.Region, string)> getBadRequestResponse()
|
||||
@ -41,6 +75,5 @@ namespace DamageAssesment.Api.Locations.Test
|
||||
{
|
||||
return new Locations.Models.Region { Id = "R99", Name = "Region 99", Abbreviation = "A99" };
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user