コード例 #1
0
ファイル: GitHelperTest.cs プロジェクト: Qorpent/qorpent.sys
		public void CanGetFileListUnicode()
		{
            
			var githelper = new GitHelper { DirectoryName = dirname, AuthorName = Applications.Application.Current.Principal.CurrentUser.Identity.Name };
			githelper.Connect();
			var initial = githelper.GetCommitId();
			var initialList = githelper.GetFileList();
			Assert.False(initialList.Any(_ => _ == "абв"));
			githelper.WriteAndCommit("абв", "a", "is a");
			var first = githelper.GetCommitId();
			Assert.True(githelper.GetFileList().Any(_ => _ == "абв"));
			Assert.AreEqual("a", githelper.GetContent("абв"));
		}
コード例 #2
0
ファイル: GitHelperTest.cs プロジェクト: Qorpent/qorpent.sys
		public void CanGetFileList()
		{
            Assert.NotNull(Applications.Application.Current);
		    if (null == Applications.Application.Current.Principal) {
		        var services = new StringBuilder();
		        foreach (var componentDefinition in Applications.Application.Current.Container.GetComponents()) {
		            services.AppendLine(string.Format("{0} {1}",componentDefinition.ServiceType.Name,componentDefinition.ImplementationType.Name));
		        }
                throw new Exception(services.ToString());
		    }
            Assert.NotNull(Applications.Application.Current.Principal);
            Assert.NotNull(Applications.Application.Current.Principal.CurrentUser);
            Assert.NotNull(Applications.Application.Current.Principal.CurrentUser.Identity);
			var githelper = new GitHelper { DirectoryName = dirname, AuthorName = Applications.Application.Current.Principal.CurrentUser.Identity.Name };
			githelper.Connect();
			var initial = githelper.GetCommitId();
			var initialList = githelper.GetFileList();
			Assert.False(initialList.Any(_=>_=="x"));
			githelper.WriteAndCommit("x", "a", "is a");
			var first = githelper.GetCommitId();
			Assert.True(githelper.GetFileList().Any(_ => _ == "x"));
			githelper.WriteAndCommit("x z", "b", "is b");
			Assert.True(githelper.GetFileList().Any(_ => _ == "x z"));
			Assert.False(githelper.GetFileList(first).Any(_ => _ == "x z"));
			Assert.True(githelper.GetFileList(first).Any(_ => _ == "x"));
			Assert.False(githelper.GetFileList(initial).Any(_ => _ == "x"));
		}