public void FillDocumentsInSession(Session s) { var currentDocuments = new List <SessionDocument>(); foreach (var window in _dteAdapter.GetWindowsForValidDocuments()) { var doc = new SessionDocument(window.FullPath, window.DocumentType); currentDocuments.Add(doc); } var sessionDocuments = new List <SessionDocument>(s.GetDocuments()); for (int i = sessionDocuments.Count - 1; i >= 0; i--) { if (!currentDocuments.Contains(sessionDocuments[i])) { s.RemoveDocument(sessionDocuments[i]); } } foreach (var currDoc in currentDocuments) { s.AddDocument(currDoc); } }
public IEnumerable<Session> GetAllSessions() { var sessions = new Collection<Session>(); var s1 = new Session("Class1 + Class2"); s1.AddDocument(new SessionDocument(@"c:\VSProjects\Prueba1\ClassLibrary2\Class1.cs", DocumentType.Text)); s1.AddDocument(new SessionDocument(@"c:\VSProjects\Prueba1\ClassLibrary1\Class2.cs", DocumentType.Text)); sessions.Add(s1); var s2 = new Session("Class1"); s2.AddDocument(new SessionDocument(@"c:\VSProjects\Prueba1\ClassLibrary2\Class1.cs", DocumentType.Text)); s2.AddDocument(new SessionDocument(@"c:\VSProjects\Prueba1\ClassLibrary2\pepe.cs", DocumentType.Text)); sessions.Add(s2); var s3 = new Session("Class2 + Form1"); s3.AddDocument(new SessionDocument(@"c:\VSProjects\Prueba1\ClassLibrary1\Class2.cs", DocumentType.Text)); s3.AddDocument(new SessionDocument(@"c:\VSProjects\Prueba1\ClassLibrary1\Form1.cs", DocumentType.Designer)); s3.AddDocument(new SessionDocument(@"c:\VSProjects\Prueba1\ClassLibrary1\Form1.cs", DocumentType.Text)); s3.AddDocument(new SessionDocument(@"c:\VSProjects\Prueba1\ClassLibrary1\XMLFile1.xml", DocumentType.Text)); s3.AddDocument(new SessionDocument(@"c:\VSProjects\Prueba1\ClassLibrary1\ClassDiagram1.cd", DocumentType.Text)); sessions.Add(s3); return sessions; }
public void TestSessionMapObjToDto() { var session = new Session("session"); var sessionDocument = new SessionDocument("path", DocumentType.Designer); session.AddDocument(sessionDocument); var sessionDto = new SessionDto(); DtoMapper.MapObjToDto(session, sessionDto); Assert.AreEqual(session.Name, sessionDto.Name); Assert.AreEqual(session.GetDocuments().Count(), sessionDto.DocumentsCount); Assert.AreEqual(sessionDocument.Path, sessionDto.Documents[0].Path); Assert.AreEqual(sessionDocument.Type, sessionDto.Documents[0].Type); }
public IEnumerable<Session> GetAllSessions() { var repositoryFile = getRepositoryFile(); var sessionsList = new List<Session>(); var xmlSessionsNode = getSecondLevelNode(repositoryFile, TAG_SESSIONS); foreach (XmlNode sessionNode in xmlSessionsNode) { var session = new Session(sessionNode.Attributes[ATTRIBUTE_SESSION_NAME].Value); foreach (XmlNode documentNode in sessionNode.ChildNodes[0].ChildNodes) { var document = new SessionDocument(documentNode.Attributes[ATTRIBUTE_DOC_PATH].Value, (DocumentType)Enum.Parse(typeof(DocumentType), documentNode.Attributes[ATTRIBUTE_DOC_TYPE].Value)); session.AddDocument(document); } sessionsList.Add(session); } return sessionsList.AsEnumerable(); }
public IEnumerable <Session> GetAllSessions() { var repositoryFile = getRepositoryFile(); var sessionsList = new List <Session>(); var xmlSessionsNode = getSecondLevelNode(repositoryFile, TAG_SESSIONS); foreach (XmlNode sessionNode in xmlSessionsNode) { var session = new Session(sessionNode.Attributes[ATTRIBUTE_SESSION_NAME].Value); foreach (XmlNode documentNode in sessionNode.ChildNodes[0].ChildNodes) { var document = new SessionDocument(documentNode.Attributes[ATTRIBUTE_DOC_PATH].Value, (DocumentType)Enum.Parse(typeof(DocumentType), documentNode.Attributes[ATTRIBUTE_DOC_TYPE].Value)); session.AddDocument(document); } sessionsList.Add(session); } return(sessionsList.AsEnumerable()); }
public void FillDocumentsInSession(Session s) { var currentDocuments = new List<SessionDocument>(); foreach (var window in _dteAdapter.GetWindowsForValidDocuments()) { var doc = new SessionDocument(window.FullPath, window.DocumentType); currentDocuments.Add(doc); } var sessionDocuments = new List<SessionDocument>(s.GetDocuments()); for (int i = sessionDocuments.Count - 1; i >= 0; i--) { if (!currentDocuments.Contains(sessionDocuments[i])) s.RemoveDocument(sessionDocuments[i]); } foreach (var currDoc in currentDocuments) s.AddDocument(currDoc); }