<commit_before>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GitDepend.Busi;
using Microsoft.Practices.Unity;
using NUnit.Framework;
using Telerik.JustMock;
using Telerik.JustMock.Helpers;

namespace GitDepend.UnitTests.Busi
{
	[TestFixture]
	public class GitTests : TestFixtureBase
	{
		[Test]
		public void DefaultValuesTest()
		{
			var instance = new Git();

			Assert.IsNull(instance.WorkingDirectory);
		}

		[Test]
		public void CheckoutTest()
		{
			string command = null;
			string arguments = null;
			var processManager = Container.Resolve<IProcessManager>();
			processManager.Arrange(p => p.Start(Arg.IsAny<ProcessStartInfo>()))
				.Returns((ProcessStartInfo info) =>
				{
					command = info.FileName;
					arguments = info.Arguments;

					return new FakeProcess();
				});

			var instance = new Git();
			var code = instance.Checkout("develop");

			Assert.AreEqual(ReturnCode.Success, code, "Invalid Return Code");
			Assert.AreEqual("git", command);
			Assert.AreEqual("checkout develop", arguments);
		}

		[Test]
		public void CloneTest()
		{
			string command = null;
			string arguments = null;
			var processManager = Container.Resolve<IProcessManager>();
			processManager.Arrange(p => p.Start(Arg.IsAny<ProcessStartInfo>()))
				.Returns((ProcessStartInfo info) =>
				{
					command = info.FileName;
					arguments = info.Arguments;

					return new FakeProcess();
				});

			var instance = new Git();
			var url = "ssh://git@github.com:kjjuno/Lib1.git";
			var directory = @"C:\projects\Lib1";
			var branch = "master";
			var code = instance.Clone(url, directory, branch);

			Assert.AreEqual(ReturnCode.Success, code, "Invalid Return Code");
			Assert.AreEqual("git", command);
			Assert.AreEqual($"clone {url} {directory} -b {branch}", arguments);
		}

		[Test]
		public void AddTest()
		{
			string command = null;
			string arguments = null;
			var processManager = Container.Resolve<IProcessManager>();
			processManager.Arrange(p => p.Start(Arg.IsAny<ProcessStartInfo>()))
				.Returns((ProcessStartInfo info) =>
				{
					command = info.FileName;
					arguments = info.Arguments;

					return new FakeProcess();
				});

			var instance = new Git();
			var code = instance.Add("packages.config");

			Assert.AreEqual(ReturnCode.Success, code, "Invalid Return Code");
			Assert.AreEqual("git", command);
			Assert.AreEqual("add packages.config", arguments);
		}

		[Test]
		public void StatusTest()
		{
			string command = null;
			string arguments = null;
			var processManager = Container.Resolve<IProcessManager>();
			processManager.Arrange(p => p.Start(Arg.IsAny<ProcessStartInfo>()))
				.Returns((ProcessStartInfo info) =>
				{
					command = info.FileName;
					arguments = info.Arguments;

					return new FakeProcess();
				});

			var instance = new Git();
			var code = instance.Status();

			Assert.AreEqual(ReturnCode.Success, code, "Invalid Return Code");
			Assert.AreEqual("git", command);
			Assert.AreEqual("status", arguments);
		}

		[Test]
		public void CommitTest()
		{
			string command = null;
			string arguments = null;
			var processManager = Container.Resolve<IProcessManager>();
			processManager.Arrange(p => p.Start(Arg.IsAny<ProcessStartInfo>()))
				.Returns((ProcessStartInfo info) =>
				{
					command = info.FileName;
					arguments = info.Arguments;

					return new FakeProcess();
				});

			var instance = new Git();
			var message = "This is a test message";
			var code = instance.Commit(message);

			Assert.AreEqual(ReturnCode.Success, code, "Invalid Return Code");
			Assert.AreEqual("git", command);
			Assert.AreEqual($"commit -m \"{message}\"", arguments);
		}
	}
}<commit_msg>Adds a test for the WorkingDirectory in Git.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GitDepend.Busi;
using Microsoft.Practices.Unity;
using NUnit.Framework;
using Telerik.JustMock;
using Telerik.JustMock.Helpers;

namespace GitDepend.UnitTests.Busi
{
	[TestFixture]
	public class GitTests : TestFixtureBase
	{
		[Test]
		public void DefaultValuesTest()
		{
			var instance = new Git();

			Assert.IsNull(instance.WorkingDirectory);
		}

		[Test]
		public void CheckoutTest()
		{
			string command = null;
			string arguments = null;
			var processManager = Container.Resolve<IProcessManager>();
			processManager.Arrange(p => p.Start(Arg.IsAny<ProcessStartInfo>()))
				.Returns((ProcessStartInfo info) =>
				{
					command = info.FileName;
					arguments = info.Arguments;

					return new FakeProcess();
				});

			var instance = new Git();
			var code = instance.Checkout("develop");

			Assert.AreEqual(ReturnCode.Success, code, "Invalid Return Code");
			Assert.AreEqual("git", command);
			Assert.AreEqual("checkout develop", arguments);
		}

		[Test]
		public void CloneTest()
		{
			string command = null;
			string arguments = null;
			var processManager = Container.Resolve<IProcessManager>();
			processManager.Arrange(p => p.Start(Arg.IsAny<ProcessStartInfo>()))
				.Returns((ProcessStartInfo info) =>
				{
					command = info.FileName;
					arguments = info.Arguments;

					return new FakeProcess();
				});

			var instance = new Git();
			var url = "ssh://git@github.com:kjjuno/Lib1.git";
			var directory = @"C:\projects\Lib1";
			var branch = "master";
			var code = instance.Clone(url, directory, branch);

			Assert.AreEqual(ReturnCode.Success, code, "Invalid Return Code");
			Assert.AreEqual("git", command);
			Assert.AreEqual($"clone {url} {directory} -b {branch}", arguments);
		}

		[Test]
		public void AddTest()
		{
			string command = null;
			string arguments = null;
			var processManager = Container.Resolve<IProcessManager>();
			processManager.Arrange(p => p.Start(Arg.IsAny<ProcessStartInfo>()))
				.Returns((ProcessStartInfo info) =>
				{
					command = info.FileName;
					arguments = info.Arguments;

					return new FakeProcess();
				});

			var instance = new Git();
			var code = instance.Add("packages.config");

			Assert.AreEqual(ReturnCode.Success, code, "Invalid Return Code");
			Assert.AreEqual("git", command);
			Assert.AreEqual("add packages.config", arguments);
		}

		[Test]
		public void StatusTest()
		{
			string command = null;
			string arguments = null;
			var processManager = Container.Resolve<IProcessManager>();
			processManager.Arrange(p => p.Start(Arg.IsAny<ProcessStartInfo>()))
				.Returns((ProcessStartInfo info) =>
				{
					command = info.FileName;
					arguments = info.Arguments;

					return new FakeProcess();
				});

			var instance = new Git();
			var code = instance.Status();

			Assert.AreEqual(ReturnCode.Success, code, "Invalid Return Code");
			Assert.AreEqual("git", command);
			Assert.AreEqual("status", arguments);
		}

		[Test]
		public void CommitTest()
		{
			string command = null;
			string arguments = null;
			var processManager = Container.Resolve<IProcessManager>();
			processManager.Arrange(p => p.Start(Arg.IsAny<ProcessStartInfo>()))
				.Returns((ProcessStartInfo info) =>
				{
					command = info.FileName;
					arguments = info.Arguments;

					return new FakeProcess();
				});

			var instance = new Git();
			var message = "This is a test message";
			var code = instance.Commit(message);

			Assert.AreEqual(ReturnCode.Success, code, "Invalid Return Code");
			Assert.AreEqual("git", command);
			Assert.AreEqual($"commit -m \"{message}\"", arguments);
		}

		[Test]
		public void WorkingDirectoryTest()
		{
			string workingDir = null;
			var processManager = Container.Resolve<IProcessManager>();
			processManager.Arrange(p => p.Start(Arg.IsAny<ProcessStartInfo>()))
				.Returns((ProcessStartInfo info) =>
				{
					workingDir = info.WorkingDirectory;

					return new FakeProcess();
				});

			var instance = new Git() { WorkingDirectory = Lib1Directory };
			var message = "This is a test message";
			var code = instance.Commit(message);

			Assert.AreEqual(ReturnCode.Success, code, "Invalid Return Code");
			Assert.AreEqual(Lib1Directory, workingDir);
		}
	}
}
{'fraction_non_alphanumeric': 0.1338303593253483, 'fraction_numerical': 0.0007333170373991689, 'mean_word_length': 3.7575581395348836, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6327205', 'n_tokens_mistral': 2956, 'n_tokens_neox': 2426, 'n_words': 577}