Exemplo n.º 1
0
        private void TestParseAllEvents()
        {
            //Arrange
            Script tester = new Script();

            foreach (string file in Directory.EnumerateFiles("events", "*.txt"))
            {
                string contents = File.ReadAllText(file);
                //Act
                EventTabModel         model     = EventParser.CreateEventFromScript(file, contents);
                EventContainer        container = new EventContainer(model);
                List <EventContainer> list      = new List <EventContainer> {
                    container
                };
                Dictionary <string, string> files = EventParser.ParseAllEvents(list);
                string filecontent = files.FirstOrDefault().Value;
                string fileName    = files.FirstOrDefault().Key;
                //Assert
                Assert.IsNotNull(model);
                Assert.IsTrue(model.EventList.Any());
                Assert.IsNotNull(fileName);
                Assert.IsNotNull(filecontent);
                tester.Analyse(filecontent);
                Assert.IsFalse(tester.Logger.hasErrors());
            }
        }
Exemplo n.º 2
0
        private EventTabModel TestScriptToEvent()
        {
            //Arrange
            string eventScript = File.ReadAllText("Baltic.txt");
            //Act
            EventTabModel model = EventParser.CreateEventFromScript("Baltic.txt", eventScript);

            //Assert
            Assert.IsNotNull(model);
            Assert.IsTrue(model.EventList.Any());
            Assert.AreEqual(model.EventNamespace, "baltic");
            Assert.AreEqual(model.VisibleName, "Baltic");
            return(model);
        }