예제 #1
0
        public void Read_ReadsText123_FromFile()
        {
            //Arrange
            string expected = "123";
            string actual;
            var file = new LocalFile(_path);
            File.WriteAllText(_path, expected);

            //Act
            Stream myFile = file.Read();
            using (var reader = new StreamReader(myFile))
            {
                actual = reader.ReadToEnd();
            }

            //Assert
            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public void Read_ThrowsFileNotFoundException_WhenFileDoesntExist()
        {
            //Arrange
            var file = new LocalFile($@"C:\{Guid.NewGuid()}.txt");

            //Act & Assert
            file.Read(); //Exception
        }