示例#1
0
        public void CredentialsValidationTest()
        {
            var username = "******";
            var password = "******";
            var result   = _services.CredentialsValidation(username, password);

            Assert.That(result, Is.True, "Validation code is wrong.");
        }
示例#2
0
        public ActionResult Index(HttpPostedFileBase postedFile, string username, string password)
        {
            if (postedFile == null)
            {
                ViewBag.Message = "Please provide a zip file.";
                return(View());
            }
            var fileExtension = Path.GetExtension(postedFile.FileName);
            var fileName      = Path.GetFileNameWithoutExtension(postedFile.FileName);

            if (!_service.CredentialsValidation(username, password))
            {
                ViewBag.Message = "Password or username is wrong.";
                return(View());
            }

            if (!_service.ZipValidation(fileExtension))
            {
                ViewBag.Message = "Please provide a zip file.";
                return(View());
            }

            var treePath      = _service.FileProcess(postedFile);
            var directoryInfo = new DirectoryInfo(treePath);
            var treeResult    = directoryInfo.ToJson(f => f.LastWriteTimeUtc);

            ViewBag.Message = _service.SendRequest(username, password, treeResult);
            return(View());
        }