コード例 #1
0
        /// <summary>
        /// Gets the day with the least change from the file / data provided.
        /// </summary>
        /// <param name="fileLocation"> The location of the file that contains our data. </param>
        /// <returns>
        /// The day entry in the file for the day that has the least temperature change.
        /// </returns>
        public int GetDayWithLeastChange(string fileLocation)
        {
            // Contract requirements.
            if (string.IsNullOrWhiteSpace(fileLocation))
            {
                throw new ArgumentNullException(nameof(fileLocation), "The file location can not be null.");
            }

            var fileData = _fileReader.GetWeatherData(fileLocation);
            int result   = _weatherData.GetDayOfLeastTemperatureChange(fileData);

            return(result);
        }
コード例 #2
0
        public void Test_get_day_with_valid_input_and_data_returns_expected_day()
        {
            // Arrange.
            const int    expected = 6;
            const string input    = "fullFile";

            _reader.GetWeatherData(Arg.Any <string>()).Returns(new List <Weather>());
            _notify.GetDayOfLeastTemperatureChange(Arg.Any <List <Weather> >()).Returns(6);

            // Act.
            var actual = _weatherDataManager.GetDayWithLeastChange(input);

            // Assert.
            actual.Should().Be(expected);
        }