forked from MDCPS/DamageAssessment_Backend
Copy from old Repository
This commit is contained in:
@ -0,0 +1,84 @@
|
||||
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(i, Guid.NewGuid().ToString() + "@gmail.com")
|
||||
{
|
||||
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.Db.Attachment>> getInputAttachmentData()
|
||||
{
|
||||
List<Attachments.Db.Attachment> Attachments=new List<Db.Attachment>();
|
||||
Attachments.Add(new Db.Attachment{ Id = 0, AnswerId = 10, ResponseId = 10, URI = "sample", IsDeleted = false,FileName="sample1" }) ;
|
||||
return Attachments;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user