DamageAssessment_Backend/DamageAssesmentApi/DamageAssesment.Api.Attachments.Test/MockData.cs
2023-08-25 18:24:46 -04:00

85 lines
2.9 KiB
C#

using DamageAssesment.Api.Attachments.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;
namespace DamageAssesment.Api.Attachments.Test
{
public class MockData
{
public static async Task<(bool, List<Attachments.Models.Attachment>, string)> getOkResponse()
{
List<Attachments.Models.Attachment> list = new List<Attachments.Models.Attachment>();
for (int i = 0; i < 10; i++)
{
list.Add(new Attachments.Models.Attachment()
{
Id = i,
AnswerId = i,
URI = Guid.NewGuid().ToString() + "@gmail.com",
ResponseId = i,
IsDeleted = false,
FileName="sample"+i
});
}
return (true, list, null);
}
public static async Task<Attachments.Models.AttachmentInfo> GetAttachmentInfo(int id)
{
List<FileModel> files = new List<FileModel>();
List<AnswerInfo> answerInfos = new List<AnswerInfo>();
files.Add(new FileModel()
{
AttachmentId = id,
FileName = "Sample1",
FileContent = "sample",
FileExtension = ".jpg"
});
answerInfos.Add(new AnswerInfo()
{
AnswerId = 1,
postedFiles = files
});
return new AttachmentInfo
{
ResponseId = 1,
Answers = answerInfos
};
}
public static async Task<(bool, Attachments.Models.Attachment, string)> getOkResponse(int Id)
{
var Attachments = await getOkResponse();
var Attachment = Attachments.Item2.FirstOrDefault(s => s.Id == Id);
return (true, Attachment, null);
}
public static async Task<(bool, List<Attachments.Models.Attachment>, string)> getBadRequestResponse()
{
return (false, null, "Bad Request");
}
public static async Task<(bool, Attachments.Models.Attachment, string)> getNotFoundResponse()
{
return (false, null, "Not Found");
}
public static async Task<(bool, IEnumerable<Attachments.Models.Attachment>, string)> getNoContentResponse()
{
IEnumerable<Attachments.Models.Attachment> list = new List<Attachments.Models.Attachment>();
return (false, list, null);
}
public static async Task<List<Attachments.Models.Attachment>> getInputAttachmentData()
{
List<Attachments.Models.Attachment> Attachments=new List<Models.Attachment>();
Attachments.Add(new Models.Attachment{ Id = 0, AnswerId = 10, ResponseId = 10, URI = "sample", IsDeleted = false,FileName="sample1" }) ;
return Attachments;
}
}
}