public void TestInit() { batchSize = 1; context = new InMemoryEcaContext(); indexService = new Mock <IIndexService>(); notificationService = new Mock <IIndexNotificationService>(); service = new ProjectDocumentService(context, indexService.Object, notificationService.Object, batchSize); }
public ProjectDocumentModel Post([FromBody] ProjectDocumentModel projectDoc) { Response.StatusCode = 201; string result = ProjectDocumentService.AddProjectDocument(projectDoc, dbConn); projectDoc.Id = Convert.ToInt32(result); return(projectDoc); }
public void TestConstructor() { batchSize = 1; service = new ProjectDocumentService(context, indexService.Object, notificationService.Object, batchSize); Assert.AreEqual(batchSize, service.GetBatchSize()); var batchSizeField = typeof(ProjectDocumentService).BaseType.GetField("batchSize", BindingFlags.Instance | BindingFlags.NonPublic); var batchSizeValue = batchSizeField.GetValue(service); Assert.AreEqual(batchSize, batchSizeValue); }
public IActionResult DownloadFile([FromRoute] string filename) { byte[] fileBytes = ProjectDocumentService.DownloadFile(filename).Result; var provider = new FileExtensionContentTypeProvider(); string contentType; if (!provider.TryGetContentType(filename, out contentType)) { contentType = "application/octet-stream"; } return(new FileContentResult(fileBytes, contentType)); }
public string GetTempLink([FromRoute] string foldername, [FromRoute] string filename) { return(ProjectDocumentService.GetTempLink(foldername + '/' + filename)); }
public List <string> GetBucketContents() { return(ProjectDocumentService.ListStorage().Result); }
public string UploadFile(IFormFile file, [FromRoute] int projectId) { return(ProjectDocumentService.UploadFile(file.OpenReadStream(), file.FileName, projectId.ToString())); }
public List <ProjectDocumentModel> Get([FromRoute] int projectId) { return(ProjectDocumentService.GetProjectDocs(projectId, dbConn)); }
public string Delete([FromRoute] int id) { return(ProjectDocumentService.DeleteProjectDocument(id, dbConn)); }