Пример #1
0
        private void Load(IDiagram diagram)
        {
            string notation = diagram.CreateGenerator().Generate();

            var stringReader = new StringReader(notation);
            Queue<string> lines = stringReader.ReadAllLines();

            while (lines.Count > 0)
            {
                string line = lines.Dequeue();

                if (line.StartsWith("class") && line.EndsWith("{"))
                {
                    ClassElement @class = this.AddClass(line);
                    @class.Load(DequeueTo("}", lines));
                }
            }

        }
Пример #2
0
        public void TestReadAllLines()
        {
            var text = @"line1
            line2
            line3
            ";
              var expectedLines = new[] {
            "line1",
            "line2",
            "line3",
              };

              var reader = new StringReader(text);
              var lines = reader.ReadAllLines();

              Assert.AreEqual(expectedLines.Length, lines.Length);

              for (var i = 0; i < lines.Length; i++) {
            Assert.AreEqual(expectedLines[i], lines[i]);
              }
        }