[Test] public void NoProps() { RepositoryFile file = new RepositoryFile(repository, NO_PROPS_PATH, RepositoryStatus.Unchanged, RepositoryStatus.Unchanged); Assert.IsNull(file.GetProperty("svn:mime-type")); }
[Test] public void EolStyleProps() { RepositoryFile file = new RepositoryFile(repository, EOL_STYLE_PROP_PATH, RepositoryStatus.Unchanged, RepositoryStatus.Unchanged); String[] props = file.GetProperty("svn:eol-style"); Assert.AreEqual(1, props.Length); Assert.AreEqual("native", props[0]); }
[Test] public void LogRegexProps() { RepositoryFile file = new RepositoryFile(repository, LOGREGEGX_PROP_PATH, RepositoryStatus.Unchanged, RepositoryStatus.Unchanged); String[] props = file.GetProperty("bugtraq:logregex"); Assert.AreEqual(2, props.Length); Assert.AreEqual(@"^.*$", props[0]); Assert.AreEqual(@"\d+", props[1]); }
[Test] public void MimeProps() { RepositoryFile file = new RepositoryFile(repository, MIME_PROP_PATH, RepositoryStatus.Unchanged, RepositoryStatus.Unchanged); String[] props = file.GetProperty("svn:mime-type"); Assert.AreEqual(1, props.Length); Assert.AreEqual("text/source", props[0]); Assert.AreEqual("text/source", file.MimeType); }
public Error[] PreCommit(RepositoryFile file) { // Check files that have the proper extension // but skip the files that are deleted if (file.ContentsStatus == RepositoryStatus.Deleted || Array.IndexOf(extensions, file.Extension) == -1) { return(Error.NoErrors); } ArrayList errors = new ArrayList(); String[] props = file.GetProperty("svn:eol-style"); if (props == null || props.Length == 0 || props[0].ToLower() != "native") { return(new Error[] { new Error(file, "This file must have svn:eol-style set to native") }); } return(Error.NoErrors); }
[Test] public void GetPropertyWithNullName() { RepositoryFile file = new RepositoryFile(repository, NO_PROPS_PATH, RepositoryStatus.Unchanged, RepositoryStatus.Unchanged); file.GetProperty(null); }