示例#1
0
        public void GetXDocument_InvalidPath_ThrowsExpectedException()
        {
            var       fileReader        = new XmlDocumentReader();
            Exception expectedException = null;

            try
            {
                fileReader.GetXDocument(@"garbarge.txt");
            }
            catch (Exception e)
            {
                expectedException = e;
            }

            Assert.IsNotNull(expectedException);
            Assert.AreEqual(@"File specified by garbarge.txt does not exist", expectedException.Message);
        }
示例#2
0
        public void GetLines_EmptyFile_ThrowsExpectedException()
        {
            string filename = "empty.txt";

            using (File.Create(filename));
            var       fileReader        = new XmlDocumentReader();
            Exception expectedException = null;

            try
            {
                fileReader.GetXDocument(filename);
            }
            catch (Exception e)
            {
                expectedException = e;
            }
            File.Delete(filename);

            Assert.IsNotNull(expectedException);
            Assert.AreEqual(@"File specified by empty.txt is empty", expectedException.Message);
        }