public void GetOverMedianByPercentage_MultipleFiles_CorrectResults() { var dataColumn = "Data Value"; var dateTimeStampColumn = "Date/Time"; var fileA = GetTestingFileA(); var fileB = GetTestingFileB(); var fileC = GetTestingFileC(); var processor = new MockingFileProcessor(dataColumn, dateTimeStampColumn); processor.SetDataAndPrepareProcessing(fileB); var resultSetB = processor.GetOverMedianByPercentage((decimal)0.1); Assert.NotNull(resultSetB.ProcessResults); Assert.AreEqual(resultSetB.ProcessResults.Count(), 0); processor.SetDataAndPrepareProcessing(fileA); var resultSetA = processor.GetOverMedianByPercentage((decimal)0.1); var median = (decimal)29.7125; Assert.AreEqual(resultSetA.MedianValue, median); Assert.AreEqual(resultSetA.FileName, "file.csv"); Assert.NotNull(resultSetA.ProcessResults); Assert.AreEqual(resultSetA.ProcessResults.Count(), 2); Assert.IsTrue(resultSetA.ProcessResults.Any(result => result.Value == (decimal)36.42 && result.DateTimeStamp == "31/08/2015 01:00:00")); Assert.IsTrue(resultSetA.ProcessResults.Any(result => result.Value == (decimal)32.90 && result.DateTimeStamp == "31/08/2015 01:15:00")); processor.SetDataAndPrepareProcessing(fileC); var resultSetC = processor.GetOverMedianByPercentage((decimal)0.2); median = (decimal)34.013333; Assert.AreEqual(resultSetC.MedianValue, median); Assert.AreEqual(resultSetC.FileName, "fileC.csv"); Assert.NotNull(resultSetC.ProcessResults); Assert.AreEqual(resultSetC.ProcessResults.Count(), 1); Assert.IsTrue(resultSetC.ProcessResults.Any(result => result.Value == (decimal)45.97 && result.DateTimeStamp == "31/09/2015 01:23:00")); }
public void GetOverMedianByPercentage_10Percent_RecordFound() { var dataColumn = "Data Value"; var dateTimeStampColumn = "Date/Time"; var file = GetTestingFileA(); var processor = new MockingFileProcessor(dataColumn, dateTimeStampColumn); processor.SetDataAndPrepareProcessing(file); var resultSet = processor.GetOverMedianByPercentage((decimal)0.1); var median = (decimal)29.7125; Assert.AreEqual(resultSet.MedianValue, median); Assert.AreEqual(resultSet.FileName, "file.csv"); Assert.NotNull(resultSet.ProcessResults); Assert.AreEqual(resultSet.ProcessResults.Count(), 2); Assert.IsTrue(resultSet.ProcessResults.Any(result => result.Value == (decimal)36.42 && result.DateTimeStamp == "31/08/2015 01:00:00")); Assert.IsTrue(resultSet.ProcessResults.Any(result => result.Value == (decimal)32.90 && result.DateTimeStamp == "31/08/2015 01:15:00")); }