Beispiel #1
0
        public void FlawedLenghtOfLIne()
        {
            StreamReader s     = new StreamReader(@"D:\MFF\ZS_2019\c#_repos\Nezarka\NezarkaTests\bin\Debug\netcoreapp3.0\Ins\FlawedLenghtOfLine.txt");
            ModelStore   store = ModelStore.LoadFrom(s);

            Assert.IsNull(store);
        }
Beispiel #2
0
        public void InputCorrect()
        {
            StreamReader s     = new StreamReader(@"D:\MFF\ZS_2019\c#_repos\Nezarka\NezarkaTests\bin\Debug\netcoreapp3.0\Ins\Databaze.txt");
            ModelStore   store = ModelStore.LoadFrom(s);

            Assert.IsNotNull(store);
        }
Beispiel #3
0
        public void GeneralTests()
        {
            StreamWriter sw     = new StreamWriter(@"TestFiles\Outs\NezarkaTest.html");
            StreamReader Reader = new StreamReader(@"TestFiles\NezarkaTest.in");
            ModelStore   store  = ModelStore.LoadFrom(Reader);

            Controler.ReadAdnDoRequests(Reader, sw, store);
            sw.Close();
            Reader.Close();
            bool b = Utils.FileDiff(@"TestFiles\Outs\NezarkaTest.html", @"TestFiles\NezarkaTest.out");

            Assert.IsTrue(b);
        }
        private ModelStore ModelMockup()
        {
            StringReader input = new StringReader(
                "DATA-BEGIN\n" +
                "BOOK;1;Lord of the Rings;J. R. R. Tolkien;59\n" +
                "BOOK;2;Hobbit: There and Back Again;J. R. R. Tolkien;49\n" +
                "BOOK;3;Going Postal;Terry Pratchett;28\n" +
                "BOOK;4;The Colour of Magic;Terry Pratchett;159\n" +
                "BOOK;5;I Shall Wear Midnight;Terry Pratchett;31\n" +
                "CUSTOMER;1;Pavel;Jezek\n" +
                "CUSTOMER;2;Jan;Kofron\n" +
                "CUSTOMER;3;Petr;Hnetynka\n" +
                "CUSTOMER;4;Tomas;Bures\n" +
                "CART-ITEM;2;1;3\n" +
                "CART-ITEM;2;5;1\n" +
                "DATA-END\n");

            return(ModelStore.LoadFrom(input));
        }
Beispiel #5
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            var reader = Console.In;

            var store = ModelStore.LoadFrom(reader);

            if (store == null)
            {
                CustomerListBox.SelectionMode = SelectionMode.None;
                CustomerListBox.Items.Add("Customer databaze currently unavailable.");
                return;
            }

            List <Customer> customers = store.GetCustomersList();

            foreach (var item in customers)
            {
                CustomerListBox.Items.Add(item);
            }
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            TextReader stdin      = new StreamReader(Console.OpenStandardInput(), Console.InputEncoding);
            ModelStore modelStore = ModelStore.LoadFrom(stdin);

            if (modelStore == null)
            {
                Console.WriteLine("Data error.");
                return;
            }


            NezarkaDispatcher dispatcher = new NezarkaDispatcher(modelStore);

            string command;

            while ((command = stdin.ReadLine()) != null)
            {
                dispatcher.Dispatch(command);
                Console.WriteLine("====");
            }
        }