Exemplo n.º 1
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IHostingEnvironment env)
 {
     app.UseRealIp();
     if (env.IsDevelopment())//开发环境
     {
         app.UseDeveloperExceptionPage();
     }
     else
     {
         app.UseExceptionHandler("/Error/Index");
     }
     app.UseStatusCodePages();
     app.UseStaticFiles();
     app.UseSession();
     //gzip压缩中间件
     app.UseResponseCompression();
     //Response 缓存中间件
     app.UseResponseCaching();
     app.UseMvc(routes =>
     {
         routes.MapRoute(
             name: "areas",
             template: "{area:exists}/{controller}/{action=Index}/{id?}"
             );
         routes.MapRoute(
             name: "default",
             template: "{controller=Home}/{action=Index}/{id?}");
     });
     //初始化数据库
     InitSystem.InitDB(app.ApplicationServices);
 }
Exemplo n.º 2
0
        private void deleteStore(string storeName)
        {
            Store store = InitSystem.getStore(storeName);

            WorkShop.deleteStore(store.id);
            store = InitSystem.getStore(storeName);
            Assert.IsNull(store);
        }
Exemplo n.º 3
0
        private void addStore(string storeName, string userName)
        {
            string command = $"{add_store}({userName},{storeName})";

            string[] splitedCommand = InitSystem.splitCommand(command);
            InitSystem.openStore(splitedCommand);
            Store store = InitSystem.getStore(storeName);

            Assert.IsNotNull(store);
        }
Exemplo n.º 4
0
        private void addUser(string userName)
        {
            string command = $"{register}({userName},{userPass},A,27/02/1994)";

            string[] splitedCommand = InitSystem.splitCommand(command);
            InitSystem.registerNewUser(splitedCommand);
            User user = InitSystem.getUser(userName, userPass);

            Assert.IsNotNull(user);
        }
Exemplo n.º 5
0
        private void addProduct(string userName, string storeName, string productName)
        {
            string command = $"{add_product}({userName},{storeName},{productName},A,funny bunny,{price},{amount})";

            string[] splitedCommand = InitSystem.splitCommand(command);
            InitSystem.addProductStore(splitedCommand);
            Store   store   = InitSystem.getStore(storeName);
            Product product = InitSystem.getProduct(store, productName);

            Assert.IsNotNull(product);
        }
Exemplo n.º 6
0
        public void splitCommandTest()
        {
            string command = "one(two,three,a-1)";

            string[] splited = InitSystem.splitCommand(command);
            Assert.AreEqual(4, splited.Length);
            Assert.AreEqual("one", splited[0]);
            Assert.AreEqual("two", splited[1]);
            Assert.AreEqual("three", splited[2]);
            Assert.AreEqual("a-1", splited[3]);
        }
Exemplo n.º 7
0
        internal static IntPtr InitSystem_1()
        {
            hinstCadIO = NativeMethods.LoadLibrary(@"C:\Users\Josep\source\repos\testDXF\bin\Debug\CadIO.dll");

            if (hinstCadIO == IntPtr.Zero)
            {
                System.Windows.Forms.MessageBox.Show(Marshal.GetLastWin32Error().ToString());
            }

            GETPROCADDRESS("drwCreate");

            InitSystem initSystem = (InitSystem)Marshal.GetDelegateForFunctionPointer(pProc, typeof(InitSystem));

            return(initSystem());
        }
Exemplo n.º 8
0
        public void makeAdminTest()
        {
            string userName = "******";

            addUser(userName);

            string command = $"{make_admin}({userName})";

            string[] splitedCommand = InitSystem.splitCommand(command);
            InitSystem.makeAdmin(splitedCommand);
            User user = InitSystem.getUser(userName, userPass);

            Assert.IsTrue(user is SystemAdmin);

            ConnectionStubTemp.removeAdmin((SystemAdmin)user);
        }
Exemplo n.º 9
0
        public void addStoreOwnerTest()
        {
            string userName = "******", userName2 = "F", storeName = "S4";

            addUser(userName);
            addUser(userName2);
            addStore(storeName, userName);

            string command = $"{add_manager}({userName},{storeName},{userName2})";

            string[] splitedCommand = InitSystem.splitCommand(command);
            InitSystem.addStoreOwner(splitedCommand);
            Store         store    = InitSystem.getStore(storeName);
            List <Member> managers = StoreService.getAllManagers(store.id);
            User          user     = InitSystem.getUser(userName2, userPass);

            Assert.AreEqual(2, managers.Count);
            Assert.IsTrue(managers.Contains((Member)user));

            deleteUser(userName);
            deleteUser(userName2);
            deleteStore(storeName);
        }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            try
            {
                DataAccessSetup();
                InitSystem.initSystem();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            /*var leaf1 = new { type = 1, data = 20, list = 1 };
             * var leaf2 = new { type = 2, data = "x", list = 1 };
             * int [] x = { 1, 3, 4 };
             * var complex = new { type =x, data = "", first = leaf1, second = leaf2 };
             *
             * JObject messageObj = JObject.Parse(JsonHandler.SerializeObject(complex));
             * Console.WriteLine(messageObj);*/


            //Setup();
            CommunicationManager manager = new CommunicationManager();
        }
Exemplo n.º 11
0
        private void deleteUser(String userName)
        {
            User user = InitSystem.getUser(userName, userPass);

            ConnectionStubTemp.removeMember((Member)user);
        }
Exemplo n.º 12
0
 public void Init()
 {
     InitSystem.Init(this);
 }