Beispiel #1
0
        public void Create_From_DirectoryInfo_Relative_Parent()
        {
            var sut = new SmartFolder(new DirectoryInfo(".."));

            sut.ToString("O").Should().Be("..");
            sut.ToString("G").Should().Be(new DirectoryInfo(Environment.CurrentDirectory).Parent.FullName + @"\");
        }
Beispiel #2
0
        public void ToString_With_R_Format_Returns_The_Relative_Path()
        {
            var sut = new SmartFolder("..");

            sut.ToString("R").Should().Be(@"..\");
            sut.ToString("G").Should().NotBe("..");
        }
Beispiel #3
0
        public void Add_Sub_Path_By_Using_Add_Operator_With_String()
        {
            var sut = new SmartFolder(@"C:\");

            sut += "temp";
            sut.ToString().Should().Be(@"C:\temp\");
        }
Beispiel #4
0
        public void Operator_MinMin_Moves_One_Directory_Up()
        {
            var sut = new SmartFolder(@"C:\Windows\Temp\");

            sut--;
            sut.ToString().Should().Be(@"C:\Windows\");
        }
Beispiel #5
0
        public void Expand_EnvironmentVariable()
        {
            var sut = new SmartFolder("%Temp%");

            sut.ToString().Should().Be(ExpandEnvironmentVariables("%Temp%") + @"\");
        }
Beispiel #6
0
        public void Relative_Path_Does_Not_Start_With_A_Directory_Separator()
        {
            var sut = new SmartFolder("temp");

            sut.ToString("R").Should().Be(@"temp\");
        }
Beispiel #7
0
        public void Create_From_DirectoryInfo_Relative()
        {
            var sut = new SmartFolder(new DirectoryInfo("."));

            sut.ToString("O").Should().Be(".");
        }
Beispiel #8
0
        public void Path_Must_Be_Valid()
        {
            var sut = new SmartFolder(@"C:\Temp\");

            sut.ToString().Should().Be(@"C:\Temp\");
        }
Beispiel #9
0
        public void RelativePath_Is_Resolved_To_AbsolutePath()
        {
            var sut = new SmartFolder(".");

            sut.ToString().Should().Be(Environment.CurrentDirectory + @"\");
        }
Beispiel #10
0
        public void SpecialFolder_That_Exists_Is_Resolved()
        {
            var sut = new SmartFolder(SpecialFolder.Desktop);

            sut.ToString().Should().Contain(@"\Desktop\");
        }
Beispiel #11
0
        public void ToString_With_L_Format_Returns_The_Path_Separated_By_Slashes()
        {
            var sut = new SmartFolder(@"C:\Users\John Doe\");

            sut.ToString("L").Should().Be("C:/Users/John Doe/");
        }
Beispiel #12
0
        public void ToString_With_R_Format_Returns_The_Relative_Path_And_Adds_A_Trailing_Directory_Separator()
        {
            var sut = new SmartFolder("..");

            sut.ToString("R").Should().Be(@"..\");
        }
Beispiel #13
0
        public void ToString_With_E_Format_Returns_The_Escaped_Path()
        {
            var sut = new SmartFolder(@"C:\Users\John Doe\");

            sut.ToString("E").Should().Be("\"C:\\Users\\John Doe\\\"");
        }
Beispiel #14
0
        public void ToString_With_O_Format_Returns_The_Original_Path()
        {
            var sut = new SmartFolder("%Temp%");

            sut.ToString("O").Should().Be("%Temp%");
        }
Beispiel #15
0
        public void ToString_With_G_Format_Expands_Environment_Variable()
        {
            var sut = new SmartFolder("%Temp%");

            sut.ToString("G").Should().Be(ExpandEnvironmentVariables("%Temp%") + @"\");
        }