public void TestInitialize()
 {
     CheckOutCommand cmd = new CheckOutCommand(_root, _connection);
      cmd.Initialize();
      Assert.IsTrue(cmd.Requests.Count > 0);
      Assert.AreEqual(1, cmd.Requests.OfType<CheckOutRequest>().Count());
      Assert.AreEqual(1, cmd.Requests.OfType<RootRequest>().Count());
      Assert.AreEqual(1, cmd.Requests.OfType<DirectoryRequest>().Count());
 }
 public void TestCheckoutModule()
 {
     CheckOutCommand cmd = new CheckOutCommand(_root, _connection);
      string result = cmd.CheckoutModule;
      Assert.AreEqual(_root.Module, result);
      cmd.CheckoutModule = "mod/source";
      result = cmd.CheckoutModule;
      Assert.AreEqual("mod/source", result);
 }
예제 #3
0
        public void TestCommandToXML()
        {
            IRoot root = new Root(TestConfig.RepositoryPath, TestConfig.ModuleName, TestConfig.CVSHost, TestConfig.CVSPort, TestConfig.Username, TestConfig.Password);
             root.WorkingDirectory = TestConfig.WorkingDirectory;
             MockRepository mocks = new MockRepository();
             IConnection connection = mocks.Stub<IConnection>();
             CheckOutCommand cmd = new CheckOutCommand(root, connection);

             // add requests to items
             foreach (ICommandItem item in cmd.RequiredRequests)
             {
            cmd.Items.Add(item);
             }

             foreach (ICommandItem item in cmd.Requests)
             {
            cmd.Items.Add(item);
             }

             // add responses to command
             IResponse response = new AuthResponse();
             IList<string> process = new List<string> { "I LOVE YOU" };
             response.Initialize(process);
             cmd.Items.Add(response);

             response = new ValidRequestsResponse();
             IList<string> lines = new List<string> { "Root Valid-responses valid-requests Global_option" };
             response.Initialize(lines);
             cmd.Items.Add(response);

             IList<IResponse> coresponses = TestHelper.GetMockCheckoutResponses("8 Dec 2009 15:26:27 -0000", "mymod/", "file1.cs");
             foreach (IResponse cor in coresponses)
             {
            cmd.Responses.Add(cor);
             }

             XDocument xdoc = cmd.GetXDocument();
             Console.WriteLine(xdoc.ToString());
             bool result = TestHelper.ValidateCommandXML(xdoc);
             Assert.IsTrue(result);
        }
 public void TestCheckoutCommandExecute()
 {
     CheckOutCommand command = new CheckOutCommand(_root, _connection);
      command.Execute();
      TestHelper.SaveCommandConversation(command, @"c:\_junk\checkout.xml");
 }
 public void TestSaveCVSFolderIsTrue()
 {
     CheckOutCommand cmd = new CheckOutCommand(_root, _connection);
      Assert.IsTrue(cmd.SaveCVSFolder);
 }