123 lines
4.7 KiB
C#
123 lines
4.7 KiB
C#
using DamageAssesment.Api.Documents.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.Mail;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DamageAssesment.Api.Documents.Test
|
|
{
|
|
public class MockData
|
|
{
|
|
|
|
public static async Task<(bool, List<Documents.Models.MultiLanDocument>, string)> getOkResponse()
|
|
{
|
|
List<Documents.Models.MultiLanDocument> list = new List<Documents.Models.MultiLanDocument>();
|
|
|
|
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<Documents.Models.DocumentsTranslation> documentsTranslations = new List<DocumentsTranslation>();
|
|
documentsTranslations.Add(new DocumentsTranslation()
|
|
{
|
|
Language = "en",
|
|
title = "tel"+i,
|
|
description = "Sample"+i
|
|
});
|
|
list.Add(new Documents.Models.MultiLanDocument()
|
|
{
|
|
|
|
Id = i,
|
|
linkTypeId = i,
|
|
docName = "sample"+i,
|
|
url = "testurl" + i,
|
|
Path = "testpath" + i,
|
|
IsActive = true,
|
|
titles= dicttitle,
|
|
description=dictdesc,
|
|
dateCreated = DateTime.Now,
|
|
dateUpdated = DateTime.Now
|
|
});
|
|
}
|
|
return (true, list, null);
|
|
}
|
|
public static async Task<(bool, Documents.Models.MultiLanDocument, string)> getOkResponse(int Id)
|
|
{
|
|
var Documents = await getOkResponse();
|
|
var Document = Documents.Item2.FirstOrDefault(s => s.Id == Id);
|
|
return (true, Document, null);
|
|
}
|
|
|
|
public static async Task<(bool, Documents.Models.MultiLanDocument, string)> getBadRequestResponse()
|
|
{
|
|
return (false, null, "Bad Request");
|
|
}
|
|
|
|
public static async Task<(bool, Documents.Models.MultiLanDocument, string)> getNotFoundResponse()
|
|
{
|
|
return (false, null, "Not Found");
|
|
}
|
|
public static async Task<(bool, IEnumerable<Documents.Models.MultiLanDocument>, string)> getNoContentResponse()
|
|
{
|
|
IEnumerable<Documents.Models.MultiLanDocument> list = new List<Documents.Models.MultiLanDocument>();
|
|
return (false, list, null);
|
|
}
|
|
public static async Task<Documents.Models.DocumentInfo> GetDocumentsInfo(int id)
|
|
{
|
|
FileModel fileModel = new FileModel() { FileName = "Sample", FileContent = "c2FtcGxl", FileExtension = ".txt" };
|
|
return new DocumentInfo() { Id=id, linkTypeId = 1, url = "Sample", File = fileModel };
|
|
}
|
|
public static async Task<Documents.Models.Document> getInputDocumentData()
|
|
{
|
|
List<Documents.Models.DocumentsTranslation> documentsTranslations = new List<DocumentsTranslation>();
|
|
documentsTranslations.Add(new DocumentsTranslation()
|
|
{
|
|
Language = "en",
|
|
title = "tel",
|
|
description = "Sample"
|
|
});
|
|
return new Models.Document
|
|
{
|
|
Id = 1,
|
|
linkTypeId = 1,
|
|
docName = "sample",
|
|
url = "testurl",
|
|
Path = "testpath",
|
|
IsActive = true,
|
|
documentsTranslations= documentsTranslations,
|
|
dateCreated = DateTime.Now,
|
|
dateUpdated = DateTime.Now
|
|
};
|
|
}
|
|
public static async Task<List<Documents.Models.Document>> getInputDocumentsData()
|
|
{
|
|
List<Documents.Models.DocumentsTranslation> documentsTranslations = new List<DocumentsTranslation>();
|
|
documentsTranslations.Add(new DocumentsTranslation()
|
|
{
|
|
Language = "en",
|
|
title = "tel",
|
|
description="Sample"
|
|
});
|
|
List<Documents.Models.Document> Documents = new List<Models.Document>();
|
|
Documents.Add(new Models.Document
|
|
{
|
|
Id = 1,
|
|
linkTypeId = 1,
|
|
docName = "sample",
|
|
url = "testurl",
|
|
Path = "testpath",
|
|
IsActive = true,
|
|
documentsTranslations= documentsTranslations,
|
|
dateCreated = DateTime.Now,
|
|
dateUpdated = DateTime.Now
|
|
});
|
|
return Documents;
|
|
}
|
|
|
|
}
|
|
}
|