示例#1
0
        public void Moving_file_tracks_the_new_file()
        {
            // assert
            const string fileName    = "3156f567-b366-421a-923d-fd774eaf20fb.tmp";
            const string newFileName = "9cacdcdf-a520-43b2-b826-82bd083f3b87.txt";

            // act
            using (var file = new TemporaryFile(fileName))
            {
                File.WriteAllText(fileName, "Anything");
                File.Exists(fileName).Should().BeTrue();
                file.MoveTo(newFileName);
                // assert
                file.FileInfo.Name.Should().Be(newFileName);
                File.Exists(fileName).Should().BeFalse();
                File.Exists(newFileName).Should().BeTrue();
            }
            File.Exists(fileName).Should().BeFalse();
            File.Exists(newFileName).Should().BeFalse();
        }