public void Read_ThrowsFileNotFoundException_WhenFileDoesntExist()
        {
            //Arrange
            var file = new LocalFile($@"C:\{Guid.NewGuid()}.txt");

            //Act & Assert
            file.Read(); //Exception
        }
        public async Task WriteAsync_ThrowsArgumentNullException_WhenStreamIsNull()
        {
            //Arrange
            var file = new LocalFile(@"C:\TestPath");

            //Act
            await file.WriteAsync(null); //Exception
        }
        public void Write_ThrowsArgumentNullException_WhenStreamIsNull()
        {
            //Arrange
            var file = new LocalFile(@"C:\TestPath");

            //Act
            file.Write(null); //Exception
        }
        public async Task WriteAsync_ThrowsArgumentException_WhenStreamIsntReadable()
        {
            //Arrange
            Mock<Stream> streamMock = new Mock<Stream>();
            streamMock.Setup(m => m.CanRead).Returns(false);

            Stream stream = streamMock.Object;
            var file = new LocalFile(@"C:\TestPath");

            //Act & Assert
            await file.WriteAsync(stream); //Exception
        }
        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);
        }
        public async Task WriteAsync_WritesText123_ToFile()
        {
            //Arrange
            string expected = "123";
            string actual;
            var file = new LocalFile(_path);
            byte[] text = expected.Select(Convert.ToByte).ToArray();

            //Act
            using (var memoryStream = new MemoryStream(text))
            {
                await file.WriteAsync(memoryStream);
            }

            actual = File.ReadAllText(_path);

            //Assert
            Assert.AreEqual(expected, actual);
        }