Exemplo n.º 1
0
        public void TestGetMainMenuNotImplemented()
        {
            CopyDll("MainMenuNotImplemented.dll");

            DllManager dllManager = new DllManager();
            Role role = new Role()
            {
                RoleModules = new List<RoleModule>()
                {
                    new RoleModule()
                    {
                        Module = new Module()
                        {
                            Name = "MainMenuNotImplemented"
                        }
                    }
                }
            };

            try
            {
                List<IMainMenu> mainMenus = dllManager.GetMainMenus(role);
                Assert.Fail();
            }
            catch (MainMenuNotImplementedException e1)
            {
                Assert.IsNotNull(e1);
            }
            catch (Exception)
            {
                Assert.Fail();
            }
        }
Exemplo n.º 2
0
        public void TestGetMainMenus()
        {
            DllManager dllManager = new DllManager();
            Role role = new Role()
            {
                RoleModules = new List<RoleModule>()
                {
                    new RoleModule()
                    {
                        Module = new Module()
                        {
                            Name = "SupErpModuleUser"
                        }
                    }
                }
            };

            List<IMainMenu> mainMenus = dllManager.GetMainMenus(role);
            Assert.IsNotNull(mainMenus);
            Assert.AreEqual(1, mainMenus.Count);
            Assert.AreEqual("Administration", mainMenus[0].MenuName);
            Assert.IsTrue(mainMenus[0].SubMenus.Count > 0);
        }
Exemplo n.º 3
0
        public async void Connect()
        {
            ErrorMsgVisibility = System.Windows.Visibility.Collapsed;
            var user = await WCFManager.UserServiceClient.LoginAsync(login, password);

            if (user != null)
            {
                DllManager dllManager = new DllManager();
                IEnumerable<IMainMenu> mainMenus = dllManager.GetMainMenus(user.Role);
                MainWindow.MainFrame.Navigate(new MenuPage(mainMenus));
            }
            else
            {
                ErrorMsgVisibility = System.Windows.Visibility.Visible;
                LoadRingState = false;
            }
        }