Пример #1
0
        public void ContentType()
        {
            using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig()))
            {
                var client = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW);

                WebDAV.Directory root = client.Root;

                var file1 = root.NavigatePath("/trunk/Source/NFX/LICENSE.txt");
                var file2 = root.NavigatePath("/trunk/Source/NFX.Wave/Templatization/StockContent/Embedded/flags/ad.png");

                Assert.AreEqual(0, string.Compare("text/xml; charset=\"utf-8\"", file1.ContentType, true));
                Assert.AreEqual(0, string.Compare("application/octet-stream", file2.ContentType, true));
            }
        }
Пример #2
0
        public void DifferentFileVersions()
        {
            using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig()))
            {
                IList <WebDAV.Version> versions = WebDAV.GetVersions(SVN_ROOT, SVN_UNAME, SVN_UPSW).ToList();

                WebDAV.Version v1530 = versions.First(v => v.Name == "1530");
                WebDAV.Version v1531 = versions.First(v => v.Name == "1531");

                var client1530 = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW, version: v1530);

                var client1531 = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW, version: v1531);

                WebDAV.Directory root1530 = client1530.Root;
                WebDAV.Directory root1531 = client1531.Root;

                WebDAV.File file1530 = root1530.NavigatePath("trunk/Source/NFX.Web/IO/FileSystem/SVN/WebDAV.cs") as WebDAV.File;
                WebDAV.File file1531 = root1531.NavigatePath("trunk/Source/NFX.Web/IO/FileSystem/SVN/WebDAV.cs") as WebDAV.File;

                using (MemoryStream ms1530 = new MemoryStream())
                {
                    using (MemoryStream ms1531 = new MemoryStream())
                    {
                        file1530.GetContent(ms1530);
                        file1531.GetContent(ms1531);

                        Assert.AreNotEqual(ms1530.Length, ms1531.Length);
                    }
                }
            }
        }
Пример #3
0
        public static void NavigatePath()
        {
            InitCONSTS();

            WebDAV client = new WebDAV(ROOT, 0, UNAME, UPSW);

            WebDAV.Directory root = client.Root;

            WebDAV.Directory nested = root.NavigatePath("/trunk/Source/NFX/") as WebDAV.Directory;
        }
Пример #4
0
        public void NavigatePathFile()
        {
            using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig()))
            {
                var client = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW);

                WebDAV.Directory root = client.Root;

                WebDAV.File nested = root.NavigatePath("/trunk/Source/NFX/LICENSE.txt") as WebDAV.File;

                Assert.IsNotNull(nested);
                Assert.AreEqual("LICENSE.txt", nested.Name);

                using (MemoryStream s = new MemoryStream())
                {
                    nested.GetContent(s);
                    Assert.Greater(s.Length, 0);
                }
            }
        }
Пример #5
0
        public void NavigatePathFile()
        {
            using (new AzosApplication(null, LACONF.AsLaconicConfig()))
            {
                var client = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW);

                WebDAV.Directory root = client.Root;

                WebDAV.File nested = root.NavigatePath("/trunk/Source/Azos/LICENSE.txt") as WebDAV.File;

                Aver.IsNotNull(nested);
                Aver.AreEqual("LICENSE.txt", nested.Name);

                using (MemoryStream s = new MemoryStream())
                {
                    nested.GetContent(s);
                    Aver.IsTrue(s.Length > 0);
                }
            }
        }
Пример #6
0
        public void NavigatePathFolder()
        {
            using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig()))
            {
                var client = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW);

                WebDAV.Directory root = client.Root;

                WebDAV.Directory nested = root.NavigatePath("/trunk/Source/NFX") as WebDAV.Directory;

                Assert.IsNotNull(nested);
                Assert.AreEqual("NFX", nested.Name);
                Assert.AreEqual("/trunk/Source/NFX", nested.Path);

                Assert.AreEqual("Source", nested.Parent.Name);
                Assert.AreEqual("/trunk/Source", nested.Parent.Path);

                Assert.AreEqual("trunk", nested.Parent.Parent.Name);
                Assert.AreEqual("/trunk", nested.Parent.Parent.Path);
            }
        }
Пример #7
0
        public void NavigatePathFolder()
        {
            using (new AzosApplication(null, LACONF.AsLaconicConfig()))
            {
                var client = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW);

                WebDAV.Directory root = client.Root;

                WebDAV.Directory nested = root.NavigatePath("/trunk/Source/Azos") as WebDAV.Directory;

                Aver.IsNotNull(nested);
                Aver.AreEqual("Azos", nested.Name);
                Aver.AreEqual("/trunk/Source/Azos", nested.Path);

                Aver.AreEqual("Source", nested.Parent.Name);
                Aver.AreEqual("/trunk/Source", nested.Parent.Path);

                Aver.AreEqual("trunk", nested.Parent.Parent.Name);
                Aver.AreEqual("/trunk", nested.Parent.Parent.Path);
            }
        }
Пример #8
0
        public void DifferentDirectoryVersions()
        {
            using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig()))
            {
                IList <WebDAV.Version> versions = WebDAV.GetVersions(SVN_ROOT, SVN_UNAME, SVN_UPSW).ToList();

                WebDAV.Version v1513 = versions.First(v => v.Name == "1513");
                WebDAV.Version v1523 = versions.First(v => v.Name == "1523");

                var client1513 = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW, version: v1513);

                var client1523 = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW, version: v1523);

                WebDAV.Directory root1513 = client1513.Root;
                WebDAV.Directory root1523 = client1523.Root;

                WebDAV.Directory nested1513 = root1513.NavigatePath("trunk/Source/NFX.Web/IO/FileSystem") as WebDAV.Directory;
                WebDAV.Directory nested1523 = root1523.NavigatePath("trunk/Source/NFX.Web/IO/FileSystem") as WebDAV.Directory;

                Assert.IsNull(nested1513["SVN"]);
                Assert.IsNotNull(nested1523["SVN"]);
            }
        }