GetTempDirectory() public static method

public static GetTempDirectory ( ) : string
return string
Exemplo n.º 1
0
        public void GetTempDirectory__DirectoryDoesExistAndCanBeDeleted()
        {
            string dir = Utils.GetTempDirectory();

            Directory.Exists(dir).Should().BeTrue();

            // ReSharper disable once UnusedVariable
            Utils.DeleteDirectory(dir, out string errorMessage).Should().BeTrue();
        }
Exemplo n.º 2
0
        public void GetTempDirectory__DirectoryDoesExistAndCanBeDeleted()
        {
            string dir = Utils.GetTempDirectory();

            Assert.IsTrue(Directory.Exists(dir));
            string errorMessage;

            Assert.IsTrue(Utils.DeleteDirectory(dir, out errorMessage));
        }
Exemplo n.º 3
0
        public void GetTempDirectory__DirectoryDoesExistAndCanBeDeleted()
        {
            string dir = Utils.GetTempDirectory();

            Directory.Exists(dir).Should().BeTrue();

            string errorMessage;

            Utils.DeleteDirectory(dir, out errorMessage).Should().BeTrue();
        }
Exemplo n.º 4
0
        public void DeleteDirectory_CanNotBeDeleted_ReturnsFalseAndMessage()
        {
            string dir = Utils.GetTempDirectory();

            SetReadonlyFlag(dir);

            string errorMessage;
            bool   result = Utils.DeleteDirectory(dir, out errorMessage);

            result.Should().BeFalse();
            errorMessage.Should().Contain(dir);

            RemoveReadonlyFlag(dir);

            result = Utils.DeleteDirectory(dir, out errorMessage);

            result.Should().BeTrue();
            errorMessage.Should().BeNull();
        }
Exemplo n.º 5
0
        public void DeleteDirectory_CanNotBeDeleted_ReturnsFalseAndMessage()
        {
            string dir = Utils.GetTempDirectory();

            SetReadonlyFlag(dir);

            string errorMessage;
            bool   result = Utils.DeleteDirectory(dir, out errorMessage);

            Assert.IsFalse(result);
            Assert.IsTrue(errorMessage.Contains(dir));

            RemoveReadonlyFlag(dir);

            result = Utils.DeleteDirectory(dir, out errorMessage);

            Assert.IsTrue(result);
            Assert.IsNull(errorMessage);
        }