DamageAssessment_Backend/DamageAssesmentApi/DamageAssesment.Api.Documents.Test/MockData.cs

118 lines
4.3 KiB
C#
Raw Normal View History

2023-08-31 18:00:51 -05:00
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.Document>, string)> getOkResponse()
{
List<Documents.Models.Document> list = new List<Documents.Models.Document>();
for (int i = 1; i < 4; i++)
{
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.Document()
{
Id = i,
linkTypeId = i,
docName = "sample"+i,
url = "testurl" + i,
Path = "testpath" + i,
IsActive = true,
documentsTranslations= documentsTranslations,
dateCreated = DateTime.Now,
dateUpdated = DateTime.Now
});
}
return (true, list, null);
}
public static async Task<(bool, Documents.Models.Document, 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.Document, string)> getBadRequestResponse()
{
return (false, null, "Bad Request");
}
public static async Task<(bool, Documents.Models.Document, string)> getNotFoundResponse()
{
return (false, null, "Not Found");
}
public static async Task<(bool, IEnumerable<Documents.Models.Document>, string)> getNoContentResponse()
{
IEnumerable<Documents.Models.Document> list = new List<Documents.Models.Document>();
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;
}
}
}