public void method_Should_returnFile_size() { fd = new FileDetails(); string fileName = "C:/test.txt"; var result = fd.Size(fileName); Assert.IsNotNull(result); }
public void Size_WithFilename_ReturnsIntegerWithinRange() { var fileDetails = new FileDetails(); var result = fileDetails.Size("c:/test.txt"); Assert.IsTrue(result >= 100000 && result < 200000); }
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."); }
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); }
public void SizeTest() { FileDetails fd = new FileDetails(); fd.Size(@"c:\test.txt"); }
public string Size(string file) { return(_fileDetails.Size(file).ToString()); }
public T Get <T>(string path) { return((T)Convert.ChangeType(_fileDetails.Size(path), typeof(T))); }
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."); }
public string GetDetails(string filePath) => _fileDetails.Size(filePath).ToString();
/// <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))); }