PathSpecTest.cs #3

  • //
  • guest/
  • eskopljak/
  • p4api.net/
  • main/
  • p4api.net-unit-test/
  • PathSpecTest.cs
  • View
  • Commits
  • Open Download .zip Download (3 KB)
using Perforce.P4.PCOM;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace UnitTests
{
    
    
    /// <summary>
    ///This is a test class for PathSpecTest and is intended
    ///to contain all PathSpecTest Unit Tests
    ///</summary>
	[TestClass()]
	public class PathSpecTest
	{


		private TestContext testContextInstance;

		/// <summary>
		///Gets or sets the test context which provides
		///information about and functionality for the current test run.
		///</summary>
		public TestContext TestContext
		{
			get
			{
				return testContextInstance;
			}
			set
			{
				testContextInstance = value;
			}
		}

		#region Additional test attributes
		// 
		//You can use the following additional attributes as you write your tests:
		//
		//Use ClassInitialize to run code before running the first test in the class
		//[ClassInitialize()]
		//public static void MyClassInitialize(TestContext testContext)
		//{
		//}
		//
		//Use ClassCleanup to run code after all tests in a class have run
		//[ClassCleanup()]
		//public static void MyClassCleanup()
		//{
		//}
		//
		//Use TestInitialize to run code before running each test
		//[TestInitialize()]
		//public void MyTestInitialize()
		//{
		//}
		//
		//Use TestCleanup to run code after each test has run
		//[TestCleanup()]
		//public void MyTestCleanup()
		//{
		//}
		//
		#endregion


		internal virtual PathSpec CreatePathSpec()
		{
			// TODO: Instantiate an appropriate concrete class.
			PathSpec target = null;
			return target;
		}

		/// <summary>
		///A test for Equals
		///</summary>
		[TestMethod()]
		public void EqualsTest()
		{
			PathSpec left = new DepotPath("//depot/main/test.txt");
			PathSpec rightpos = new DepotPath("//depot/main/test.txt");
			PathSpec rightneg1 = new DepotPath("//depot/main/empty.bmp");
			PathSpec rightneg2 = new ClientPath("//depot/main/test/txt");
			PathSpec rightnull = null;

			Assert.IsTrue(left.Equals(rightpos));
			Assert.IsFalse(left.Equals(rightneg1));
			Assert.IsFalse(left.Equals(rightneg2));
			Assert.IsFalse(left.Equals(rightnull));

			left = new ClientPath("//user_workspace/main/test.txt");
			rightpos = new ClientPath("//user_workspace/main/test.txt");
			rightneg1 = new ClientPath("//user_workspace/main/empty.bmp");
			rightneg2 = new DepotPath("//user_workspace/main/test.txt");
			rightnull = null;

			Assert.IsTrue(left.Equals(rightpos));
			Assert.IsFalse(left.Equals(rightneg1));
			Assert.IsFalse(left.Equals(rightneg2));
			Assert.IsFalse(left.Equals(rightnull));

			left = new LocalPath(@"C:\workspace_root\test.txt");
			rightpos = new LocalPath(@"C:\workspace_root\test.txt");
			rightneg1 = new LocalPath(@"C:\workspace_root\empty.bmp");
			rightneg2 = new DepotPath(@"C:\workspace_root\test.txt");
			rightnull = null;

			Assert.IsTrue(left.Equals(rightpos));
			Assert.IsFalse(left.Equals(rightneg1));
			Assert.IsFalse(left.Equals(rightneg2));
			Assert.IsFalse(left.Equals(rightnull));
		}
	}
}
# Change User Description Committed
#3 28480 eskopljak submit
#2 28479 eskopljak submit
#1 28441 eskopljak Merging using p4api.net_branch
//guest/perforce_software/p4api-net/main/p4api.net-unit-test/PathSpecTest.cs
#1 19043 Liz Lam Rename p4api.net to p4api-net
//guest/perforce_software/p4api.net/main/p4api.net-unit-test/PathSpecTest.cs
#1 19042 Liz Lam Rename/move file(s) to proper main branch.
//guest/perforce_software/p4api.net/p4api.net-unit-test/PathSpecTest.cs
#2 8964 Bill fix line endings
#1 8873 Matt Attaway Initial add of the P4API.NET source code