public void ReadNumbers_ValidFile_ReturnsNumbers()
        {
            var filePath       = Common.GetFilePath("valid file.csv");
            var numbersService = new NumbersService(filePath);

            var numbers = numbersService.ReadNumbers();

            numbers.Count.Should().Be(1000);
        }
Exemple #2
0
        public void Setup()
        {
            _calculationsService = new CalculationsService();

            var filePath = Common.GetFilePath("valid file.csv");

            _numbersService = new NumbersService(filePath);

            _numbers = _numbersService.ReadNumbers();
        }
        public void ReadNumbers_InvalidFileContents_ThrowsException()
        {
            var filePath       = Common.GetFilePath("invalid file.csv");
            var numbersService = new NumbersService(filePath);

            Action act = () => numbersService.ReadNumbers();

            act.Should().Throw <CorruptFileException>()
            .WithMessage($"The file {filePath} contains invalid data.");
        }
        public void ReadNumbers_InvalidFilePath_ThrowsException()
        {
            var filePath       = Common.GetFilePath("non-existant file.csv");
            var numbersService = new NumbersService(filePath);

            Action act = () => numbersService.ReadNumbers();

            act.Should().Throw <ArgumentException>()
            .WithMessage($"The file {filePath} is invalid.");
        }