Ejemplo n.º 1
0
        public void ReadFile_WhenNonExistingFilePath_ThrowsFileNotFoundException()
        {
            //arrange
            var configurationFileReader = new ConfigurationFileReader();

            //act
            Action readFile = () => configurationFileReader.ReadFile("randomFilePath");

            //assert
            readFile.Should().Throw <FileNotFoundException> ();
        }
Ejemplo n.º 2
0
        public void ReadFile_WhenFileIsEmpty_ThrowsArgumentNullException()
        {
            //arrange
            var configurationFileReader = new ConfigurationFileReader();

            //act
            Action readFile = () =>
                              configurationFileReader.ReadFile(
                "TestData\\Empty_Config.txt");

            //assert
            readFile.Should().Throw <ArgumentNullException> ();
        }
Ejemplo n.º 3
0
        public void ReadFile_WhenFileContainsInformation_ReturnsExpectedList()
        {
            //arrange
            var configurationFileReader = new ConfigurationFileReader();
            var expectedList            = new List <Configuration>
            {
                new Configuration {
                    ConfigurationId = "ordersPerHour", ConfigurationValue = "6000"
                }
            };

            //act
            var configurationList = configurationFileReader.ReadFile(
                "TestData\\Base_Config.txt");

            //assert
            configurationList.Should().BeEquivalentTo(expectedList);
        }