示例#1
0
        public void Changing_file_name_extension_without_dot_add_dot_to_the_extension()
        {
            // assert
            const string fileName             = "de353a17-66ef-46f0-8a24-6ac4a4f6f89c.tmp";
            const string newExtensionFileName = "de353a17-66ef-46f0-8a24-6ac4a4f6f89c.txt";

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