public void method_Should_returnFile_size()
        {
            fd = new FileDetails();
            string fileName = "C:/test.txt";
            var    result   = fd.Size(fileName);

            Assert.IsNotNull(result);
        }
Ejemplo n.º 2
0
        public void Size_WithFilename_ReturnsIntegerWithinRange()
        {
            var fileDetails = new FileDetails();

            var result = fileDetails.Size("c:/test.txt");

            Assert.IsTrue(result >= 100000 && result < 200000);
        }
Ejemplo n.º 3
0
        public void Get_File_Size()
        {
            //Arrange
            FileDetails objDetails = new FileDetails();
            var         version    = "-s";
            int         actual     = 0;
            var         expected   = "4.2.9";

            //Act
            if (fileSize.Contains(version))
            {
                actual = objDetails.Size(filePath);
            }

            //Assert
            Assert.AreNotEqual(expected, actual);
        }
        public string GetFileAttribute(string attributeRequest, string filePath)
        {
            if (string.IsNullOrEmpty(filePath))
            {
                throw new ArgumentNullException(filePath);
            }

            var fileAttribute = _fileAttributeRequestParser.ParseFileAttributeRequest(attributeRequest);

            if (fileAttribute == FileAttribute.Size)
            {
                return(_fileDataTools.Size(filePath).ToString());
            }

            if (fileAttribute == FileAttribute.Version)
            {
                return(_fileDataTools.Version(filePath));
            }

            throw new Exception("Invalid file attribute requested.");
        }
Ejemplo n.º 5
0
        public string ProcessFileData(string strInParam)
        {
            try
            {
                string[]    strParam          = strInParam.Split(' ');
                FileDetails oFileDetails      = new FileDetails();
                string      strMsgValidInputs = "Please, enter valid Inputs.";

                string[] arrVersion = ConfigurationSettings.AppSettings["VersionCollection"].Split(',');
                string[] arrSize    = ConfigurationSettings.AppSettings["SizeCollection"].Split(',');


                if (strInParam.Length <= 2)
                {
                    strReturnData = strMsgValidInputs;
                }
                else if (arrSize.Contains(strParam[0].ToLower()))
                {
                    strReturnData = String.Concat("File Size: ", Convert.ToString(oFileDetails.Size(strParam[1].Trim())));
                }
                else if (arrVersion.Contains(strParam[0].ToLower()))
                {
                    strReturnData = String.Concat("File Version: ", oFileDetails.Version(strParam[1].Trim()));
                }
                else
                {
                    strReturnData = strMsgValidInputs;
                }
            }
            catch (Exception Ex)
            {
                strReturnData = ConfigurationSettings.AppSettings["CustomErrorMsg"];
            }

            return(strReturnData);
        }
Ejemplo n.º 6
0
        public void SizeTest()
        {
            FileDetails fd = new FileDetails();

            fd.Size(@"c:\test.txt");
        }
Ejemplo n.º 7
0
 public string Size(string file)
 {
     return(_fileDetails.Size(file).ToString());
 }
Ejemplo n.º 8
0
 public T Get <T>(string path)
 {
     return((T)Convert.ChangeType(_fileDetails.Size(path), typeof(T)));
 }
Ejemplo n.º 9
0
 public int FetchSizeFromDB(string filePath)
 {
     return(_objFileDetails.Size(_strFilePath));
 }
        public void TEST_SIZE_NEGATIVE()
        {
            FileDetails fileDetails = new FileDetails(@"C:\Test.txt");

            Assert.IsNull(fileDetails.Size());
        }
        public void TEST_SIZE_POSITIVE()
        {
            FileDetails fileDetails = new FileDetails(@"C:\Test.txt");

            Assert.AreNotEqual(fileDetails.Size(), 0, "File Size is zero bytes.");
        }
Ejemplo n.º 12
0
 public string GetDetails(string filePath) => _fileDetails.Size(filePath).ToString();
Ejemplo n.º 13
0
        /// <summary>
        /// Calling Thirdparty for getting file size
        /// </summary>
        /// <param name="strFilename">filename as input</param>
        /// <returns>returning file size</returns>
        private string GetSize(string strFilename)
        {
            FileDetails objFileDetails = new FileDetails();

            return(Convert.ToString(objFileDetails.Size(strFilename)));
        }