public void TestCollapseMessageResponses() { DirectoryInfo di = Directory.GetParent(Environment.CurrentDirectory); FileInfo fi = new FileInfo(Path.Combine(di.FullName, "TestSetup\\ExportCommandWithEMessages.xml")); TextReader reader = fi.OpenText(); XDocument xdoc = XDocument.Load(reader); ////bool result = TestHelper.ValidateCommandXML(xdoc); ////Assert.IsTrue(result); IRoot root = new Root(TestConfig.RepositoryPath, TestConfig.ModuleName, TestConfig.CVSHost, TestConfig.CVSPort, TestConfig.Username, TestConfig.Password); root.WorkingDirectory = TestConfig.WorkingDirectory; PServerFactory factory = new PServerFactory(); IConnection connection = new PServerConnection(); ICommand cmd = factory.CreateCommand(xdoc, new object[] { root, connection }); int count = cmd.Items.OfType<IResponse>().Count(); Assert.AreEqual(18, count); count = cmd.Items.OfType<EMessageResponse>().Count(); Assert.AreEqual(12, count); IList<IResponse> responses = cmd.Items.OfType<IResponse>().ToList(); IList<IResponse> condensed = ResponseHelper.CollapseMessagesInResponses(responses); Assert.AreEqual(7, condensed.Count); IMessageResponse message = (IMessageResponse)condensed[5]; Assert.AreEqual(12, message.Lines.Count); Console.WriteLine(message.Display()); }
public void TestCommandXMLToCommandObject() { string xml = TestStrings.CommandXMLFileWithManyItems; XDocument xdoc = XDocument.Parse(xml); bool result = TestHelper.ValidateCommandXML(xdoc); Assert.IsTrue(result); IRoot root = new Root(TestConfig.RepositoryPath, TestConfig.ModuleName, TestConfig.CVSHost, TestConfig.CVSPort, TestConfig.Username, TestConfig.Password); root.WorkingDirectory = TestConfig.WorkingDirectory; PServerFactory factory = new PServerFactory(); IConnection connection = new PServerConnection(); ICommand cmd = factory.CreateCommand(xdoc, new object[] { root, connection }); Assert.IsInstanceOf<CheckOutCommand>(cmd); Assert.AreEqual(2, cmd.RequiredRequests.Count); Assert.AreEqual(3, cmd.Requests.Count); Assert.AreEqual(3, cmd.Items.OfType<IResponse>().Count()); }
public void SetUp() { _mocks = new MockRepository(); _client = _mocks.StrictMock<ICVSTcpClient>(); _connection = new PServerConnection(); _connection.TcpClient = _client; }