public void UploadToS3Completed_Test()
        {
            // this test inserts a new file into the database and updates its status
            // by completing it
            string         fileName = "testfile.jpg";
            AppFileService target   = (AppFileService)AppFileEN.GetService("");
            var            appFile  = target.InsertNewFile(fileName, (int)EntityEnums.AppEntityFileTypeEnum.Test_Picture_Upload, TestEnums.User.constPatientUserID);

            Assert.AreEqual(appFile.AppFileUploadStatusID, (short)EntityEnums.AppEntityFileUploadStatus.Incomplete);
            string fileKey = "systemtest/testfile.jpg";

            target.DeleteFromS3(fileKey); // clearning test

            byte[] bytes = { 0, 1, 2, 3, 4 };
            target.UploadFileToS3(fileKey, bytes, "image/jpg", Guid.NewGuid());
            target.UploadToS3Completed(new AppFileUploadToS3CompletedSP()
            {
                AppFileID = appFile.AppFileID
            });

            var   actualfile = target.GetByIDT(appFile.AppFileID);
            short newStatus  = actualfile.AppFileUploadStatusID;

            try // Cleaning test data
            {
                target.DeleteFromS3(fileKey);
                target.Delete(actualfile);
            }
            catch (Exception)
            {
            }
            Assert.AreEqual(newStatus, (short)EntityEnums.AppEntityFileUploadStatus.Completed);
        }
        public void UploadFileToS3_GetS3SignedUrl_Delete_IntegrationTest()
        {
            // https://console.aws.amazon.com/s3/home?region=us-west-2#

            AppFileService target = (AppFileService)AppFileEN.GetService("");
            string         key    = "systemtest/testintegrationfile2.jpg";

            // test deleting existing file
            try
            {
                target.DeleteFromS3(key);
            }
            catch (Exception)
            {
            }

            byte[] testbytes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
            target.UploadFileToS3(key, testbytes, "image/jpg", Guid.NewGuid());

            var url = target.GetS3SignedUrlAccess(key, 5);

            using (System.Net.WebClient w = new System.Net.WebClient())
            {
                byte[] data = w.DownloadData(url);
                Assert.IsTrue(data.Length > 0);
            }

            target.DeleteFromS3(key);
        }