public void UploadMultipleDocument_MixValidInvalid()
        {
            const int   caseId = 10000;
            ArchiveCase archiveCaseController        = new ArchiveCase();
            List <ArchiveCaseFileModel> multipleDocs = new List <ArchiveCaseFileModel>
            {
                new ArchiveCaseFileModel {
                    FileName = "A.docx", FileData = "Sample Docs Text 1"
                },
                new ArchiveCaseFileModel {
                    FileName = "B.pptx", FileData = "Sample Docs Text 2"
                },
                new ArchiveCaseFileModel {
                    FileName = "C.exe", FileData = "Sample Docs Text 3"
                },
                new ArchiveCaseFileModel {
                    FileName = "D.json", FileData = "Sample Docs Text 4"
                }
            };

            foreach (var fileDataObj in multipleDocs)
            {
                string extension  = Path.GetExtension(fileDataObj.FileName);
                var    result     = JObject.Parse(archiveCaseController.UploadDocumentInCaseFolder(caseId, fileDataObj, _objArchiveModel));
                string testResult = Convert.ToString(result["response"]);
                if (testResult.Contains("Invalid file Extension"))
                {
                    Assert.AreEqual("Invalid file Extension " + extension, result["response"]);
                }
            }
        }
        public void UploadSingleDocument_Image()
        {
            const int            caseId = 10000;
            ArchiveCase          archiveCaseController = new ArchiveCase();
            ArchiveCaseFileModel fileDataObj           = new ArchiveCaseFileModel
            {
                FileName = "Desert.jpg",
                FileData = "Excel text Sample Docs Sample Docs Sample Docs Sample Docs Sample Docs Sample Docs Sample Docs"
            };

            archiveCaseController.UploadDocumentInCaseFolder(caseId, fileDataObj, _objArchiveModel);
        }
        public void UploadSingleDocument_PPT()
        {
            const int            caseId = 10000;
            ArchiveCase          archiveCaseController = new ArchiveCase();
            ArchiveCaseFileModel fileDataObj           = new ArchiveCaseFileModel
            {
                FileName = "Powerpoint.pptx",//6.xlsx
                FileData = "Powerpoint text Sample Docs Sample Docs Sample Docs Sample Docs Sample Docs Sample Docs Sample Docs"
            };

            archiveCaseController.UploadDocumentInCaseFolder(caseId, fileDataObj, _objArchiveModel);
        }
        public void UploadSingleDocument_Notepad()
        {
            const int            caseId = 10000;
            ArchiveCase          archiveCaseController = new ArchiveCase();
            ArchiveCaseFileModel fileDataObj           = new ArchiveCaseFileModel
            {
                FileName = "Notepad.txt",
                FileData = "Notepad text Sample Docs Sample Docs Sample Docs Sample Docs Sample Docs Sample Docs Sample Docs"
            };

            archiveCaseController.UploadDocumentInCaseFolder(caseId, fileDataObj, _objArchiveModel);
        }
        public void UploadSingleDocument_Exe()
        {
            const int            caseId = 10000;
            ArchiveCase          archiveCaseController = new ArchiveCase();
            ArchiveCaseFileModel fileDataObj           = new ArchiveCaseFileModel
            {
                FileName = "fiddler4setup.exe",
                FileData = "Sample Docs Sample Docs Sample Docs Sample Docs Sample Docs Sample Docs Sample Docs"
            };
            string extension = Path.GetExtension(fileDataObj.FileName);
            var    result    = JObject.Parse(archiveCaseController.UploadDocumentInCaseFolder(caseId, fileDataObj, _objArchiveModel));

            Assert.AreEqual("Invalid file Extension " + extension, result["response"]);
        }
        public void UploadMultipleDocument_Valid()
        {
            const int   caseId = 10000;
            ArchiveCase archiveCaseController        = new ArchiveCase();
            List <ArchiveCaseFileModel> multipleDocs = new List <ArchiveCaseFileModel>
            {
                new ArchiveCaseFileModel {
                    FileName = "A.xlsx", FileData = "Sample Docs Text 1"
                },
                new ArchiveCaseFileModel {
                    FileName = "B.xls", FileData = "Sample Docs Text 2"
                },
                new ArchiveCaseFileModel {
                    FileName = "C.jpg", FileData = "Sample Docs Text 3"
                },
                new ArchiveCaseFileModel {
                    FileName = "D.jpeg", FileData = "Sample Docs Text 4"
                },
                new ArchiveCaseFileModel {
                    FileName = "E.gif", FileData = "Sample Docs Text 5"
                },
                new ArchiveCaseFileModel {
                    FileName = "F.png", FileData = "Sample Docs Text 6"
                },
                new ArchiveCaseFileModel {
                    FileName = "F.doc", FileData = "Sample Docs Text 7"
                },
                new ArchiveCaseFileModel {
                    FileName = "H.docx", FileData = "Sample Docs Text 8"
                },
                new ArchiveCaseFileModel {
                    FileName = "I.pdf", FileData = "Sample Docs Text 9"
                },
                new ArchiveCaseFileModel {
                    FileName = "J.pptx", FileData = "Sample Docs Text 10"
                },
                new ArchiveCaseFileModel {
                    FileName = "K.ppt", FileData = "Sample Docs Text 11"
                },
                new ArchiveCaseFileModel {
                    FileName = "L.txt", FileData = "Sample Docs Text 12"
                }
            };

            foreach (var fileDataObj in multipleDocs)
            {
                archiveCaseController.UploadDocumentInCaseFolder(caseId, fileDataObj, _objArchiveModel);
            }
        }
        public void UploadSingleDocument_JavaScript()
        {
            const int            caseId = 10000;
            ArchiveCase          archiveCaseController = new ArchiveCase();
            ArchiveCaseFileModel fileDataObj           = new ArchiveCaseFileModel
            {
                FileName = "script.js",
                FileData = "<script>" +
                           "alert('Javascript File');" +
                           "</script>"
            };
            string extension = Path.GetExtension(fileDataObj.FileName);
            var    result    = JObject.Parse(archiveCaseController.UploadDocumentInCaseFolder(caseId, fileDataObj, _objArchiveModel));

            Assert.AreEqual("Invalid file Extension " + extension, result["response"]);
        }
        public void UploadSingleDocument_Json()
        {
            const int            caseId = 10000;
            ArchiveCase          archiveCaseController = new ArchiveCase();
            ArchiveCaseFileModel fileDataObj           = new ArchiveCaseFileModel
            {
                FileName = "fiddler4setup.json",
                FileData = "{ 'employees':[" +
                           "{ 'firstName':'Peter', 'lastName':'Jones'}" +
                           "]}"
            };
            string extension = Path.GetExtension(fileDataObj.FileName);
            var    result    = JObject.Parse(archiveCaseController.UploadDocumentInCaseFolder(caseId, fileDataObj, _objArchiveModel));

            Assert.AreEqual("Invalid file Extension " + extension, result["response"]);
        }