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); } } } }
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; }
public void NonExistingItem() { 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 children = root.Children; var nonexistingChild = root[children.OrderBy(c => c.Name.Length).First().Name + "_"]; Assert.IsNull(nonexistingChild); } }
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)); } }
public static void FileContent() { InitCONSTS(); WebDAV client = new WebDAV(ROOT, 0, UNAME, UPSW); WebDAV.Directory root = client.Root; WebDAV.File file = root.Children.First(c => c is WebDAV.File) as WebDAV.File; using (MemoryStream ms = new MemoryStream()) { file.GetContent(ms); } }
public static void List() { InitCONSTS(); WebDAV client = new WebDAV(ROOT, 0, UNAME, UPSW); WebDAV.Directory root = client.Root; var children = root.Children; foreach (var item in children) { Console.WriteLine(item.Name); } }
public void FileContent() { 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 file = root.Children.First(c => c is WebDAV.File) as WebDAV.File; using (MemoryStream ms = new MemoryStream()) { file.GetContent(ms); Assert.Greater(ms.Length, 0); } } }
public void FileContent() { using (new AzosApplication(null, LACONF.AsLaconicConfig())) { var client = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW); WebDAV.Directory root = client.Root; WebDAV.File file = root.Children.First(c => c is WebDAV.File) as WebDAV.File; using (MemoryStream ms = new MemoryStream()) { file.GetContent(ms); Aver.IsTrue(ms.Length > 0); } } }
public void DirectoryChildren() { 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 children = root.Children; Assert.IsNotNull(children); Assert.AreEqual(3, children.Count()); Assert.IsTrue(children.Any(c => c.Name == "trunk")); var firstChild = children.First(); Assert.AreEqual(root, firstChild.Parent); } }
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); } } }
public void FailedFastTimeout() { var conf = LACONF.AsLaconicConfig(); using (var app = new NFX.ApplicationModel.ServiceBaseApplication(new string[] {}, conf)) { try { var client = new WebDAV(SVN_ROOT, 1, SVN_UNAME, SVN_UPSW); WebDAV.Directory root = client.Root; var children = root.Children; } catch (Exception ex) { Console.WriteLine(ex.ToMessageWithType()); throw; } } }
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); } } }
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); } }
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); } }
public void ItemProperties() { using (new NFX.ApplicationModel.ServiceBaseApplication(null, LACONF.AsLaconicConfig())) { var client = new WebDAV(SVN_ROOT, 0, SVN_UNAME, SVN_UPSW); WebDAV.Directory root = client.Root; Assert.Greater(root.Version.AsInt(), 0); Assert.Greater(root.CreationDate, DateTime.MinValue); Assert.Greater(root.LastModificationDate, DateTime.MinValue); var maxVersionChild = root.Children.OrderByDescending(c => c.Version).First(); Console.WriteLine("First Child: " + maxVersionChild); Assert.Greater(maxVersionChild.Version.AsInt(), 0); Assert.Greater(maxVersionChild.CreationDate, DateTime.MinValue); Assert.Greater(maxVersionChild.LastModificationDate, DateTime.MinValue); Assert.AreEqual(root.Version, maxVersionChild.Version); } }
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"]); } }