Exemple #1
0
        public void TestInitialize()
        {
            InterceptUnhandledExceptions = true;
            bool initializingCompleted = false;

            ClientLogger.Debug(" -- Beginning test initialize.");
            EnqueueConditional(() => TestGlobals.Initialized);
            EnqueueCallback(() =>
            {
                _roomService                 = new RoomServiceAdapter();
                var messageService           = new TestMessageService();
                var viewLocator              = new ViewLocator();
                _viewModelFactory            = new ViewModelFactory(_roomService, messageService, viewLocator);
                _testController              = new TestController(TestGlobals.UserTag, Guid.NewGuid().ToString(), _viewModelFactory, new TestCompanyInfo());
                _contactData                 = _testController.ContactData;
                _companyVm                   = _viewModelFactory.GetViewModel <CompanyViewModel>();
                _companyVm.Model             = TestGlobals.Company;
                _authenticationGroupVm       = _viewModelFactory.GetViewModel <AuthenticationGroupViewModel>();
                _authenticationGroupVm.Model = TestGlobals.AuthenticationGroup;
                _roomVm      = _viewModelFactory.GetViewModel <RoomViewModel>();
                _localUserVm = _viewModelFactory.GetViewModel <LocalUserViewModel>();
                _roomService.CreateClient();

                TestInitializing(() => initializingCompleted = true);
            });
            EnqueueConditional(() => initializingCompleted);
            EnqueueTestComplete();
        }
Exemple #2
0
        /// <summary>
        /// 用户登录验证
        /// </summary>
        /// <param name="model">用户视图实体类</param>
        /// <param name="inputPassword">用户输入的密码</param>
        /// <returns></returns>
        public static ValidateResponseModel LoginValidator(this LocalUserViewModel model, string inputPassword, string clientId)
        {
            var response = ValidateResponseModelFactory.Instance;

            response.IsValid = true;
            if (model == null)
            {
                response.Message = "登录名不存在";
                return(response);
            }
            if (model.State == 0)
            {
                response.Message = "用户已被锁定";
            }
            //TODO:处理密码

            if (DesEncrypt.Encrypt(inputPassword) != model.Password)
            {
                response.Message = "密码不正确";
            }
            //if (model.ClientId != clientId)
            //{
            //    response.Message = "无效的客户端应用ID";
            //}
            if (response.Message.Length > 0)
            {
                response.IsValid = false;
            }
            return(response);
        }
Exemple #3
0
        public void ClientTestInitialize()
        {
            bool pageInitialized         = false;
            bool isInitializingCompleted = false;

            EnqueueConditional(() => TestGlobals.Initialized);
            EnqueueCallback(() =>
            {
                roomPage         = new RoomPage();
                viewModelFactory = roomPage.ViewModelFactory;
                viewModelFactory.MessageService = new TestMessageService();
                viewModelFactory.RoomService.CreateClient();
                companyVm                   = viewModelFactory.GetViewModel <CompanyViewModel>();
                companyVm.Model             = TestGlobals.Company;
                authenticationGroupVm       = viewModelFactory.GetViewModel <AuthenticationGroupViewModel>();
                authenticationGroupVm.Model = TestGlobals.AuthenticationGroup;
                localUserVm                 = viewModelFactory.GetViewModel <LocalUserViewModel>();
                localUserVm.CompanyInfo     = new TestCompanyInfo();
                roomVm = viewModelFactory.GetViewModel <RoomViewModel>();

                // Simulates the results of the private InitializeAsync() method.
                roomVm.UserTag           = TestGlobals.OwnerUserTag;
                roomVm.RoomName          = TestGlobals.RoomName;
                DataGlobals.LoginSession = localUserVm.LoginSession;
                DataGlobals.OwnerUserTag = TestGlobals.OwnerUserTag;
                DataGlobals.RoomName     = TestGlobals.RoomName;

                localUserVm.Login(TestGlobals.UserTag, TestGlobals.Password, loginError => roomVm.JoinRoom(joinRoomError =>
                {
                    roomPage.PageInitialized += (page, initializedArgs) => Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        workspaceVm    = viewModelFactory.GetViewModel <WorkspaceViewModel>();
                        roomController = initializedArgs.Value;
                        Assert.IsNotNull(initializedArgs.Value, "RoomController is Null");
                        toolControl = roomPage.AlantaControls.SingleOrDefault(c => c is ToolControl) as ToolControl;
                        Assert.IsNotNull(toolControl, "ToolControl is Null");
                        workspacePanel = roomPage.AlantaControls.SingleOrDefault(c => c is WorkspacePanel) as WorkspacePanel;
                        Assert.IsNotNull(workspacePanel, "WorkspacePanel is Null");
                        webcamerasControl = roomPage.AlantaControls.SingleOrDefault(c => c is WebCamerasControl) as WebCamerasControl;
                        Assert.IsNotNull(webcamerasControl, "WebCamerasPanel is Null");
                        loginControl = roomPage.AlantaControls.SingleOrDefault(c => c is RoomHeaderControl) as RoomHeaderControl;
                        Assert.IsNotNull(loginControl, "LoginControl is Null");
                        pageInitialized = true;
                        TestInitializing(() => isInitializingCompleted = true);
                    });

                    //rb 7/7/2010 fix
                    roomPage.MinWidth  = 800;
                    roomPage.MinHeight = 600;
                    var parentPanel    = roomPage.Parent as Panel;
                    if (parentPanel != null)
                    {
                        parentPanel.Children.Remove(roomPage);
                    }
                    var scrll = new ScrollViewer {
                        HorizontalScrollBarVisibility = ScrollBarVisibility.Auto, VerticalScrollBarVisibility = ScrollBarVisibility.Auto, Content = roomPage
                    };
                    TestPanel.Children.Add(scrll);
                    roomPage.Initialize(new TestRoomInfo());
                }));
            });
            EnqueueConditional(() => pageInitialized && isInitializingCompleted);
            EnqueueTestComplete();
        }
Exemple #4
0
 public static JmpLocuser ToEntity(this LocalUserViewModel model)
 {
     return(model.MapTo <LocalUserViewModel, JmpLocuser>());
 }