Ejemplo n.º 1
0
        public void ShouldThrowXmlExceptionIfResultNull()
        {
            // pass the empty file to provoke the exception
            var path = @"C:\Users\Nino\Desktop\test\file2.xml";
            IFileReader reader = new FileReader();
            var ex = Assert.Throws<XmlException>(() => reader.GetContent(path));

            Assert.Equal(ex.GetType(), typeof(XmlException));
        }
Ejemplo n.º 2
0
        public void ShouldReturnCorrectExceptionForBadInput()
        {
            string input = string.Empty;
            IFileReader reader = new FileReader();

            ArgumentException ex = Assert.Throws<ArgumentNullException>(() => reader.TryGetFile(input));

            Assert.Equal("path", ex.ParamName);
        }
Ejemplo n.º 3
0
        public void ShouldNotReturnTrueIfPathDoesNotExist()
        {
            string path = @"C:\Users\Nino\Desktop\test2";

            IFileReader fileReader = new FileReader();
            var result = fileReader.TryGetFile(path);

            Assert.Equal(false, result);
        }
Ejemplo n.º 4
0
        public void ShouldReturnArgumentNullException()
        {
            string param = string.Empty;
            string paramName = "input";

            IFileReader reader = new FileReader();

            ArgumentException ex = Assert.Throws<ArgumentNullException>(() => reader.PreCheckInput(param, paramName));

            Assert.Equal(paramName, ex.ParamName);
            Assert.Equal(ex.GetType(), typeof(ArgumentNullException));
        }