138 lines
5.4 KiB
C#
138 lines
5.4 KiB
C#
|
using DamageAssesment.Api.DocuLinks.Models;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Net.Mail;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
|
||
|
namespace DamageAssesment.Api.DocuLinks.Test
|
||
|
{
|
||
|
public class MockData
|
||
|
{
|
||
|
|
||
|
public static async Task<(bool, List<DocuLinks.Models.ResDoculink>, string)> getOkResponse()
|
||
|
{
|
||
|
List<DocuLinks.Models.ResDoculink> list = new List<DocuLinks.Models.ResDoculink>();
|
||
|
|
||
|
for (int i = 1; i < 4; i++)
|
||
|
{
|
||
|
Dictionary<string, string> dicttitle = new Dictionary<string, string>();
|
||
|
Dictionary<string, string> dictdesc = new Dictionary<string, string>();
|
||
|
dicttitle.Add("en", "test"); dicttitle.Add("fr", "tester");
|
||
|
dictdesc.Add("en", "test"); dictdesc.Add("fr", "tester");
|
||
|
List<DoculinkTranslation> DocuLinksTranslations = new List<DoculinkTranslation>();
|
||
|
DocuLinksTranslations.Add(new DoculinkTranslation()
|
||
|
{
|
||
|
Language = "en",
|
||
|
title = "tel"+i,
|
||
|
description = "Sample"+i
|
||
|
});
|
||
|
List<DoculinkAttachments> doclinksAttachments = new List<DoculinkAttachments>();
|
||
|
doclinksAttachments.Add(new DoculinkAttachments()
|
||
|
{
|
||
|
docName = "",Path="www.google.com",
|
||
|
IsAttachments=false,CustomOrder=1
|
||
|
});
|
||
|
list.Add(new DocuLinks.Models.ResDoculink()
|
||
|
{
|
||
|
|
||
|
Id = i,
|
||
|
linkTypeId = i,
|
||
|
IsActive = true,
|
||
|
titles= dicttitle,
|
||
|
description=dictdesc,
|
||
|
CustomOrder=i,
|
||
|
doclinksAttachments= doclinksAttachments
|
||
|
});
|
||
|
}
|
||
|
return (true, list, null);
|
||
|
}
|
||
|
public static async Task<(bool, DocuLinks.Models.ResDoculink, string)> getOkResponse(int Id)
|
||
|
{
|
||
|
var DocuLinks = await getOkResponse();
|
||
|
var Document = DocuLinks.Item2.FirstOrDefault(s => s.Id == Id);
|
||
|
return (true, Document, null);
|
||
|
}
|
||
|
|
||
|
public static async Task<(bool, DocuLinks.Models.ResDoculink, string)> getBadRequestResponse()
|
||
|
{
|
||
|
return (false, null, "Bad Request");
|
||
|
}
|
||
|
|
||
|
public static async Task<(bool, DocuLinks.Models.ResDoculink, string)> getNotFoundResponse()
|
||
|
{
|
||
|
return (false, null, "Not Found");
|
||
|
}
|
||
|
public static async Task<(bool, IEnumerable<DocuLinks.Models.ResDoculink>, string)> getNoContentResponse()
|
||
|
{
|
||
|
IEnumerable<DocuLinks.Models.ResDoculink> list = new List<DocuLinks.Models.ResDoculink>();
|
||
|
return (false, list, null);
|
||
|
}
|
||
|
public static async Task<DocuLinks.Models.ReqDoculink> GetDocuLinksInfo(int id)
|
||
|
{
|
||
|
|
||
|
List<FileModel> fileModels = new List<FileModel>();
|
||
|
fileModels.Add( new FileModel() { FileName = "Sample", FileContent = "c2FtcGxl", FileExtension = ".txt",IsAttachments=true,CustomOrder=1 });
|
||
|
return new ReqDoculink() { Id=id, linkTypeId = 1, CustomOrder = 1, Files = fileModels };
|
||
|
}
|
||
|
public static async Task<DocuLinks.Models.Doculink> getInputDocumentData()
|
||
|
{
|
||
|
List<DoculinkTranslation> DocuLinksTranslations = new List<DoculinkTranslation>();
|
||
|
DocuLinksTranslations.Add(new DoculinkTranslation()
|
||
|
{
|
||
|
Language = "en",
|
||
|
title = "tel",
|
||
|
description = "Sample"
|
||
|
});
|
||
|
List<DoculinkAttachments> doclinksAttachments = new List<DoculinkAttachments>();
|
||
|
doclinksAttachments.Add(new DoculinkAttachments()
|
||
|
{
|
||
|
docName = "",
|
||
|
Path = "www.google.com",
|
||
|
IsAttachments = false,
|
||
|
CustomOrder = 1
|
||
|
});
|
||
|
return new Models.Doculink
|
||
|
{
|
||
|
Id = 1,
|
||
|
linkTypeId = 1,
|
||
|
IsActive = true,
|
||
|
CustomOrder=1,
|
||
|
documentsTranslations = DocuLinksTranslations,
|
||
|
doclinksAttachments= doclinksAttachments
|
||
|
};
|
||
|
}
|
||
|
public static async Task<List<DocuLinks.Models.Doculink>> getInputDocuLinksData()
|
||
|
{
|
||
|
List<DoculinkTranslation> DocuLinksTranslations = new List<DoculinkTranslation>();
|
||
|
DocuLinksTranslations.Add(new DoculinkTranslation()
|
||
|
{
|
||
|
Language = "en",
|
||
|
title = "tel",
|
||
|
description = "Sample"
|
||
|
});
|
||
|
List<DoculinkAttachments> doclinksAttachments = new List<DoculinkAttachments>();
|
||
|
doclinksAttachments.Add(new DoculinkAttachments()
|
||
|
{
|
||
|
docName = "",
|
||
|
Path = "www.google.com",
|
||
|
IsAttachments = false,
|
||
|
CustomOrder = 1
|
||
|
});
|
||
|
List<DocuLinks.Models.Doculink> DocuLinks = new List<Models.Doculink>();
|
||
|
DocuLinks.Add(new Models.Doculink
|
||
|
{
|
||
|
Id = 1,
|
||
|
linkTypeId = 1,
|
||
|
IsActive = true,
|
||
|
CustomOrder = 1,
|
||
|
documentsTranslations = DocuLinksTranslations,
|
||
|
doclinksAttachments = doclinksAttachments
|
||
|
});
|
||
|
return DocuLinks;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|