public FilesSizeStatistics EvaluateFilesSizeStatistics(uint inputFileSize, uint outputFileSize) { FilesSizeStatistics statistics = new FilesSizeStatistics(); statistics.InputFileSize = inputFileSize; statistics.OutputFileSize = outputFileSize; double proportion = (double)outputFileSize / (double)inputFileSize; statistics.FilesSizeProportion = Math.Round(proportion, DECIMAL_DIGITS); return(statistics); }
public void FilesSize_EvaluateStatistics() { var helper = new HuffmanStatisticsHelper(); uint inputFileSize = 100; uint outputFileSize = 50; FilesSizeStatistics expectedStatistics = new FilesSizeStatistics(); expectedStatistics.InputFileSize = 100; expectedStatistics.OutputFileSize = 50; expectedStatistics.FilesSizeProportion = 0.5; FilesSizeStatistics statistics = helper.EvaluateFilesSizeStatistics(inputFileSize, outputFileSize); Assert.AreEqual(expectedStatistics.InputFileSize, statistics.InputFileSize); Assert.AreEqual(expectedStatistics.OutputFileSize, statistics.OutputFileSize); Assert.AreEqual(expectedStatistics.FilesSizeProportion, statistics.FilesSizeProportion); }