public void AddStudentsToGroupTest() { UserGenerator.Generate(this.tests.Storage, this.demoStorage); foreach (var user in this.demoStorage.GetStudents()) { Assert.AreEqual(1, this.tests.Storage.GetUsersInGroup(this.tests.Storage.GetGroups().SingleOrDefault(g => g.Name == "Демонстраційна група")).Where(u => u.Username == user.Username).Count()); } }
void Start() { /*really unity? * * do you do that for real? * */ InitializeCharacter(); this.context = new Context(SAMPLE_XML_FILE); this.depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator; if (this.depth == null) { throw new Exception("Viewer must have a depth node!"); } this.userGenerator = new UserGenerator(this.context); this.skeletonCapbility = new SkeletonCapability(this.userGenerator); this.poseDetectionCapability = new PoseDetectionCapability(this.userGenerator); this.calibPose = this.skeletonCapbility.GetCalibrationPose(); this.userGenerator.NewUser += new UserGenerator.NewUserHandler(userGenerator_NewUser); this.userGenerator.LostUser += new UserGenerator.LostUserHandler(userGenerator_LostUser); this.poseDetectionCapability.PoseDetected += new PoseDetectionCapability.PoseDetectedHandler(poseDetectionCapability_PoseDetected); this.skeletonCapbility.CalibrationEnd += new SkeletonCapability.CalibrationEndHandler(skeletonCapbility_CalibrationEnd); this.skeletonCapbility.SetSkeletonProfile(SkeletonProfile.All); this.joints = new Dictionary <uint, Dictionary <SkeletonJoint, SkeletonJointPosition> >(); this.userGenerator.StartGenerating(); this.histogram = new int[this.depth.GetDeviceMaxDepth()]; MapOutputMode mapMode = this.depth.GetMapOutputMode(); // this.bitmap = new Bitmap((int)mapMode.nXRes, (int)mapMode.nYRes/*, System.Drawing.Imaging.PixelFormat.Format24bppRgb*/); usersLblTex = new Texture2D((int)mapMode.nXRes, (int)mapMode.nYRes); Debug.Log("usersLblTex = w: " + usersLblTex.width + " h: " + usersLblTex.height); usersMapSize = mapMode.nXRes * mapMode.nYRes; usersMapColors = new Color[usersMapSize]; usersMapRect = new Rect(Screen.width - usersLblTex.width / 2, Screen.height - usersLblTex.height / 2, usersLblTex.width / 2, usersLblTex.height / 2); usersLabelMap = new short[usersMapSize]; usersDepthMap = new short[usersMapSize]; usersHistogramMap = new float[5000]; //DepthMetaData depthMD = new DepthMetaData(); this.shouldRun = true; //this.readerThread = new Thread(ReaderThread); // this.readerThread.Start(); }
public static void Initialize() { Browser.Initialize(); UserGenerator.Initialize(); Pages.Pages.Login.Goto(); Pages.Pages.Login.LogIn(LoginOptions.PredefinedCredentials); Assert.IsTrue(Pages.Pages.TopNavigation.IsLoggedIn); }
public void RegisterNewUser() { User user = UserGenerator.Generate(); this.emailAddressTextField.SendKeys(user.EmailAddress); this.passwordTextField.SendKeys(user.Password); this.confirmPasswordTextField.SendKeys(user.Password); this.registerButton.Click(); }
static void Main(string[] args) { UserGenerator dbGenerator = new UserGenerator(); RandomizationHelper stringRandomizer = new RandomizationHelper(); Console.WriteLine(dbGenerator.GetString()); Console.WriteLine(stringRandomizer.GetRandomString(5)); Console.WriteLine(stringRandomizer.GetRandomInt(5)); Console.WriteLine(stringRandomizer.GetKEYSMASH(25)); }
public void Initialize() { _facebookUser = UserGenerator.GenerateFacebookUser(); _twitterUser = UserGenerator.GenerateTwitterUser(); _facebookResult = ProviderVerifyResultGenerator.GenFacebookVerifyResult(); _twitterResult = ProviderVerifyResultGenerator.GenTwitterVerifyResult(); _facebookGrant = AccessGrantGenerator.GenFacebookGrant(); _twitterGrant = AccessGrantGenerator.GenTwitterGrant(); _facebookCredentials = CredentialsDtoGenerator.GenFacebookCredentials(); _twitterCredentials = CredentialsDtoGenerator.GenTwitterCredentials(); }
private TestInfo GetDefaultTestInfo() { return(new TestInfo { ExitedUsers = UserGenerator.GetFakeUsers(2), NewUser = DtoUserGenerator.GetUserWithRole(Roles.Admin), Roles = RoleGenerator.GetFakeRole(1), IsPasswordValid = true, IsEmailConfirmed = true }); }
public Xtion() { Trace.WriteLine( Assembly.GetExecutingAssembly().FullName ); context = new Context(); context.GlobalMirror = true; Image = new ImageGenerator( context ); Image.NewDataAvailable += new EventHandler( ImageGenrator_NewDataAvailable ); Image.MapOutputMode = new MapOutputMode() { XRes = Width, YRes = Height, FPS = FPS }; Depth = new DepthGenerator( context ); Depth.NewDataAvailable += new EventHandler( DepthGenerator_NewDataAvailable ); Depth.MapOutputMode = new MapOutputMode() { XRes = Width, YRes = Height, FPS = FPS }; User = new UserGenerator( context ); User.NewUser += new EventHandler<NewUserEventArgs>( UserGenerator_NewUser ); User.LostUser += new EventHandler<UserLostEventArgs>( UserGenerator_LostUser ); User.UserExit += new EventHandler<UserExitEventArgs>( UserGenerator_UserExit ); User.UserReEnter += new EventHandler<UserReEnterEventArgs>( UserGenerator_UserReEnter ); User.NewDataAvailable += new EventHandler( UserGenerator_NewDataAvailable ); Skeleton = User.SkeletonCapability; if ( Skeleton.DoesNeedPoseForCalibration ) { throw new Exception( "OpenNI 1.4.0.2 以降をインストールしてください" ); } Skeleton.CalibrationComplete += new EventHandler<CalibrationProgressEventArgs>( Skeleton_CalibrationComplete ); Skeleton.SetSkeletonProfile( SkeletonProfile.HeadAndHands ); Skeleton.SetSmoothing( 0.7f ); // 画像更新のためのスレッドを作成 shouldRun = true; readerThread = new Thread( new ThreadStart( () => { while ( shouldRun ) { context.WaitAndUpdateAll(); } } ) ); readerThread.Start(); context.StartGeneratingAll(); }
public MainWindow() { InitializeComponent(); console = new Console(); console.Show(); console.Top = 0; console.Left = 0; Console.Write("TrackingNI by Richard Pianka and Ramsey Abouzahra"); context = new Context(CONFIG_FILE); imageGenerator = new ImageGenerator(context); depthGenerator = new DepthGenerator(context); userGenerator = new UserGenerator(context); poseDetectionCapability = userGenerator.PoseDetectionCapability; skeletonCapability = userGenerator.SkeletonCapability; MapOutputMode mapMode = depthGenerator.MapOutputMode; int width = (int)mapMode.XRes; int height = (int)mapMode.YRes; imageBitmap = new WriteableBitmap(width, height, DPI_X, DPI_Y, PixelFormats.Rgb24, null); depthBitmap = new WriteableBitmap(width, height, DPI_X, DPI_Y, PixelFormats.Rgb24, null); depthBitmapCorrected = new WriteableBitmap(width, height, DPI_X, DPI_Y, PixelFormats.Rgb24, null); imageData = new ImageMetaData(); depthData = new DepthMetaData(); skeletonDraw = new SkeletonDraw(); Histogram = new int[depthGenerator.DeviceMaxDepth]; reader = new Thread(new ThreadStart(Reader)); reader.IsBackground = true; worker = new BackgroundWorker(); stop = false; CompositionTarget.Rendering += new EventHandler(Worker); Closing += new System.ComponentModel.CancelEventHandler(MainWindow_Closing); userGenerator.NewUser += new EventHandler <NewUserEventArgs>(NewUser); userGenerator.LostUser += new EventHandler <UserLostEventArgs>(LostUser); skeletonCapability.CalibrationStart += new EventHandler <CalibrationStartEventArgs>(CalibrationStart); skeletonCapability.CalibrationEnd += new EventHandler <CalibrationEndEventArgs>(CalibrationEnd); skeletonCapability.SetSkeletonProfile(SkeletonProfile.All); poseDetectionCapability.PoseDetected += new EventHandler <PoseDetectedEventArgs>(PoseDetected); poseDetectionCapability.PoseEnded += new EventHandler <PoseEndedEventArgs>(PoseEnded); reader.Start(); worker.DoWork += new DoWorkEventHandler(WorkerTick); }
public void RegisterNewUser() { ClearAllRegirsterUserFormFields(); var user = UserGenerator.Generate(); emailAddressField.SendKeys(user.EmailAddress); passwordField.SendKeys(user.Password); confirmPasswordField.SendKeys(user.Password); registerButton.Click(); }
private TestInfo GetDefaultTestInfo() { var users = UserGenerator.GetFakeUsers(2); return(new TestInfo { Users = users, Profiles = users.Select(u => new UserProfile { Id = u.Id }).ToList() }); }
public void CreateGroupTest() { Assert.AreEqual(0, this.tests.Storage.GetGroups().Where(g => g.Name == "Демонстраційна група").Count()); UserGenerator.Generate(this.tests.Storage, this.demoStorage); Assert.AreEqual(1, this.tests.Storage.GetGroups().Where(g => g.Name == "Демонстраційна група").Count()); UserGenerator.Generate(this.tests.Storage, this.demoStorage); Assert.AreEqual(1, this.tests.Storage.GetGroups().Where(g => g.Name == "Демонстраційна група").Count()); }
void Close() { if (FStarted) { if (FUserGenerator != null) { FUserGenerator.Dispose(); } FUserGenerator = null; FStarted = false; } }
public bool SetConfig(XmlElement xmlconfig) { // TO-DO: add some configuration parameters if of any use this.context = new Context("NiteKinectConfig.xml"); this.depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator; if (this.depth == null) { throw new Exception("Viewer must have a depth node!"); } this.userGenerator = new UserGenerator(this.context); this.userGenerator.NewUser += userGenerator_NewUser; this.userGenerator.LostUser += userGenerator_LostUser; // this.skeletonCapbility = this.userGenerator.SkeletonCapability; this.skeletonCapbility.SetSkeletonProfile(SkeletonProfile.All); this.skeletonCapbility.CalibrationEnd += skeletonCapbility_CalibrationEnd; // this.poseDetectionCapability = this.userGenerator.PoseDetectionCapability; this.calibPose = this.skeletonCapbility.CalibrationPose; this.poseDetectionCapability.PoseDetected += poseDetectionCapability_PoseDetected; // this.handsGenerator = new HandsGenerator(this.context); this.handsGenerator.HandCreate += handsGenerator_HandCreate; this.handsGenerator.HandDestroy += handsGenerator_HandDestroy; this.handsGenerator.HandUpdate += handsGenerator_HandUpdate; // this.gestureGenerator = new GestureGenerator(this.context); this.gestureGenerator.AddGesture("Wave"); this.gestureGenerator.AddGesture("Click"); this.gestureGenerator.AddGesture("RaiseHand"); this.gestureGenerator.GestureRecognized += gestureGenerator_GestureRecognized; // this.joints = new Dictionary <int, Dictionary <SkeletonJoint, SkeletonJointPosition> >(); // this.userGenerator.StartGenerating(); this.handsGenerator.StartGenerating(); this.gestureGenerator.StartGenerating(); // this.histogram = new int[this.depth.DeviceMaxDepth]; MapOutputMode mapMode = this.depth.MapOutputMode; // this.bitmap = new Bitmap((int)mapMode.XRes, (int)mapMode.YRes); this.shouldRun = true; this.readerThread = new Thread(ReaderThread); this.readerThread.Priority = ThreadPriority.Lowest; this.readerThread.Start(); // return(true); }
public async Task PutAsyncBadRequestTest() { // Arrange var controller = new UsersController(Mock.Of <IUserService>(), _mapper); controller.ModelState.AddModelError("error", "some error"); // Act var result = await controller.PutAsync(1, UserGenerator.GetTestUpdateUserResource()); // Assert Assert.IsType <BadRequestObjectResult>(result); }
/// <summary> /// Crete random user and add it to DB /// </summary> /// <param name="countOfUsers" - the number of users to create></param> /// <param name="options" - server DB options></param> static void CreateUsersAndAddItToDB(int countOfUsers, DbContextOptions <ApplicationContext> options) { using (ApplicationContext db = new ApplicationContext(options)) { for (int i = 0; i < countOfUsers; ++i) { db.Users.Add(UserGenerator.CreateNewUser(new User())); } db.SaveChanges(); Console.WriteLine("Create users and add it to db"); } }
public void RegisterNewUser() { var User = UserGenerator.Generate(); firstNameTextField.SendKeys(User.FirstName); lastNameTextField.SendKeys(User.LastName); phoneTextField.SendKeys(User.PhoneNumber); emailAddressTextField.SendKeys(User.EmailAddress); passwordTextField.SendKeys(User.Password); confirmPasswordTextField.SendKeys(User.Password); registerButton.Click(); }
private static void SeedUsers(BillsPaymentSystemContext ctx) { for (int i = 0; i < countUsers; i++) { var user = UserGenerator.NewUser(ctx); if (IsValid(user)) { ctx.Users.Add(user); } } ctx.SaveChanges(); }
public ProfilePage(string rvname, int rank) { var PlayerWindow = Application.Current.Windows.OfType <PlayerWindow>().LastOrDefault(); UserGenerator rivalGen = new UserGenerator(rvname, "...", "Player"); cUserData = PlayerWindow.cUserData; rivalGen.generateRival(); rivalUserData = rivalGen.getUser(); rivalUserData.statistics.rank.global = rank; DataContext = rivalUserData; Console.WriteLine(rvname); InitializeComponent(); b_perf.Visibility = Visibility.Hidden; b_stat.Visibility = Visibility.Hidden; b_comp.Visibility = Visibility.Visible; }
private async void b_register_Click(object sender, RoutedEventArgs e) { if (Role == "Fan") { var metroWindow = (Application.Current.MainWindow as MetroWindow); await metroWindow.ShowMessageAsync("Register Failed", "The Fan functionality is not yet available. We'll message when it is", MessageDialogStyle.Affirmative); return; } // Create a new user and generate data. UserGenerator newUser = new UserGenerator(tb_username.Text, pb_password.Password, Role); newUser.generate(); // Read from user DB and add new user to the db string dir = Directory.GetCurrentDirectory() + "\\Data\\users.json"; List <UserTemplate> allUsers; using (var streamReader = new StreamReader(dir)) using (JsonReader reader = new JsonTextReader(streamReader)) { JsonSerializer serializer = new JsonSerializer(); allUsers = serializer.Deserialize <List <UserTemplate> >(reader); } allUsers.Add(newUser.getUser()); string json = JsonConvert.SerializeObject(allUsers, Formatting.Indented); // Write to resource and to file on PC, ON RELEASE DELETE SYSTEM.IO LINE using (var streamWriter = new StreamWriter(dir)) { streamWriter.Write(json); } System.IO.File.WriteAllText(System.AppDomain.CurrentDomain.BaseDirectory + "../../Data/users.json", json); //Redirect var mainWindow = Application.Current.Windows.OfType <MainWindow>().FirstOrDefault(); mainWindow.hideBackButton(); NavigationService.GoBack(); NavigationService.GoBack(); if (Role == "Player") { PlayerWindow n_window = new PlayerWindow(newUser.getUser()); n_window.Show(); } mainWindow.Hide(); }
void Start() { calibratedUsers = new List <int>(); calibratingUsers = new List <int>(); allUsers = new List <int>(); this.userGenerator = OpenNIContext.OpenNode(NodeType.User) as UserGenerator; //new UserGenerator(this.Context.context); this.skeletonCapbility = this.userGenerator.SkeletonCapability; this.poseDetectionCapability = this.userGenerator.PoseDetectionCapability; this.calibPose = this.skeletonCapbility.CalibrationPose; this.skeletonCapbility.SetSkeletonProfile(SkeletonProfile.All); this.userGenerator.NewUser += new EventHandler <NewUserEventArgs>(userGenerator_NewUser); this.userGenerator.LostUser += new EventHandler <UserLostEventArgs>(userGenerator_LostUser); this.poseDetectionCapability.PoseDetected += new EventHandler <PoseDetectedEventArgs>(poseDetectionCapability_PoseDetected); this.skeletonCapbility.CalibrationEnd += new EventHandler <CalibrationEndEventArgs>(skeletonCapbility_CalibrationEnd); }
private void CleanUp() { if (FUserGenerator != null) { FUserGenerator.StopGenerating(); FSkeletonCapability.CalibrationComplete -= skeletonCapbility_CalibrationComplete; FPoseDetectionCapability.PoseDetected -= poseDetectionCapability_PoseDetected; FUserGenerator.LostUser -= userGenerator_LostUser; FUserGenerator.NewUser -= userGenerator_NewUser; FUserGenerator.Dispose(); FUserGenerator = null; FJoints = null; } }
public void TestSetup() { Config.Load(); if (Config.LoggingOn) { Logger.LoggerHandlerManager.AddHandler(new FileLoggerHandler($"C:\\AutomationFiles\\Logs\\{TestContext.TestName}.log")); Logger.On(); } Logger.Log(":"); _pidsBefore = Process.GetProcessesByName(Config.Browser.ToLower()).Select(p => p.Id); CheckForTestRunOverides(); UserGenerator = new UserGenerator(); SetUpWebDriver(); CurrentDirectory = GetCurrentDir(); Pages = new PageClassFactory(Driver); Driver.Manage().Window.Maximize(); Pages.LogIn().NavigateTo(ModuleName); if (Config.Browser != "Mobile") { WebDriverFactory.CurrentBrowserPID = Process.GetProcessesByName(Config.Browser.ToLower()).Select(p => p.Id).Except(_pidsBefore).ToArray()[0]; } if (Config.Browser == "Mobile" && false) { var params1 = new Dictionary <string, string>(); params1.Add("wifi", "disabled"); var res = Executor.ExecuteJavascript("mobile:network.settings:set", params1); params1.Add("wifi", "enabled"); res = Executor.ExecuteJavascript("mobile:network.settings:set", params1); } WebDriverHelpers.SetImplicitWait(Config.DefaultTimeSpan); }
public KinectManager(InputProvider inputProvider) { this.inputProvider = inputProvider; //get configuration String OpenNiconfigPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\" + CONFIG_XML_FILE; this.context = Context.CreateFromXmlFile(OpenNiconfigPath, out scriptNode); this.depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator; if (this.depth == null) { throw new Exception("Viewer must have a depth node!"); } this.maxDepth = this.depth.DeviceMaxDepth; this.userGenerator = new UserGenerator(this.context); this.skeletonCapbility = this.userGenerator.SkeletonCapability; this.poseDetectionCapability = this.userGenerator.PoseDetectionCapability; this.calibPose = this.skeletonCapbility.CalibrationPose; this.userGenerator.NewUser += userGenerator_NewUser; this.userGenerator.LostUser += userGenerator_LostUser; this.poseDetectionCapability.PoseDetected += poseDetectionCapability_PoseDetected; this.skeletonCapbility.CalibrationComplete += skeletonCapbility_CalibrationComplete; this.skeletonCapbility.SetSkeletonProfile(SkeletonProfile.Upper); this.users = new Dictionary <int, User>(); this.userGenerator.StartGenerating(); this.mapMode = this.depth.MapOutputMode; //load settings updateSettings(); //start threads this.shouldRun = true; this.readerThread = new Thread(ReaderThread); this.readerThread.Start(); this.settingsUpdateThread = new Thread(runUpdateSettings); this.settingsUpdateThread.Start(); Console.WriteLine("Device initialized"); }
public void completeAdoption() { List <string> reducedActions = new List <string>(); List <string> reducedObstacles = new List <string>(); for (int i = 0; i < 16; i++) { if (string.IsNullOrEmpty(actions[i])) { actions[i] = "Unassigned"; } else { reducedActions.Add(actions[i]); } } for (int j = 0; j < 8; j++) { if (string.IsNullOrEmpty(obstacles[j])) { obstacles[j] = "Unassigned"; } else { reducedObstacles.Add(obstacles[j]); } } actions = reducedActions.ToArray(); obstacles = reducedObstacles.ToArray(); /* GameObject global = GameObject.Find("Global"); * GlobalVars globalVars = global.GetComponent<GlobalVars>(); * Debug.Log(globalVars.playerEmail);*/ // var user = new UserGenerator(petType, wish, petName, actions, obstacles); var user = new UserGenerator(actions, obstacles); // Debug.Log(user.actions); string json = JsonUtility.ToJson(user); // FireSaver.SavePlayer(playerName, json); FireSaver.AdoptPet(userID, user.getDictionary()); // Debug.Log(email); }
private KinectManager() { this.context = Context.CreateFromXmlFile("SamplesConfig.xml", out this.scriptNode); this.depth = context.FindExistingNode(NodeType.Depth) as DepthGenerator; this.userGenerator = new UserGenerator(context); this.userGenerator.NewUser += UserGenerator_NewUser; this.userGenerator.UserExit += UserGenerator_UserExit; this.skeletonCapability = this.userGenerator.SkeletonCapability; this.poseDetectionCapability = this.userGenerator.PoseDetectionCapability; this.poseDetectionCapability.PoseDetected += PoseDetectionCapability_PoseDetected; this.skeletonCapability.CalibrationComplete += SkeletonCapability_CalibrationComplete; this.skeletonCapability.SetSkeletonProfile(SkeletonProfile.All); this.calibPose = this.skeletonCapability.CalibrationPose; this.poseDetectionCapability.PoseDetected += poseCap_PoseDetected; // this.userGenerator.StartGenerating(); // this.context.StartGeneratingAll(); }
public void CreateAdministratorsTest() { foreach (var admin in this.demoStorage.GetAdministrators()) { Assert.IsNull(this.tests.Storage.GetUser(admin.Username)); } UserGenerator.Generate(this.tests.Storage, this.demoStorage); foreach (var admin in this.demoStorage.GetAdministrators()) { Assert.AreEqual(1, this.tests.Storage.GetUsersInRole(Common.Models.Role.Admin).Count(u => u.Username == admin.Username)); } UserGenerator.Generate(this.tests.Storage, this.demoStorage); foreach (var user in this.demoStorage.GetAdministrators()) { Assert.AreEqual(1, this.tests.Storage.GetUsers(u => u.Username == user.Username).Count()); } }
public async Task GetByIdOkTest() { //Arrange var service = new Mock <IUserService>(); var userResponse = UserGenerator.GetTestUserResponse(); service.Setup(e => e.GetByIdAsync(It.IsAny <int>())).ReturnsAsync(userResponse); var controller = new UsersController(service.Object, _mapper); //Act var result = await controller.GetById(userResponse.User.Id); //Assert var actionResult = Assert.IsType <OkObjectResult>(result); var userResource = Assert.IsAssignableFrom <UserResource>(actionResult.Value); UserAssertHelper.AssertEquals(userResponse.User, userResource); }
/// <summary> /// 订阅(关注)事件 如果用户还未关注公众号,则用户可以关注公众号,关注后微信会将带场景值关注事件推送给开发者 /// </summary> /// <returns></returns> public override IResponseMessageBase OnEvent_SubscribeRequest(RequestMessageEvent_Subscribe requestMessage) { var responseMessage = ResponseMessageBase.CreateFromRequestMessage <ResponseMessageText>(requestMessage); responseMessage.Content = "欢迎您加入五福商城大家庭"; //新关注用户的openId var openId = requestMessage.FromUserName; var userInfo = new UserOAuthService().UserInfo(openId); var parentOpenId = ""; //如果是场景关注 if (!string.IsNullOrEmpty(requestMessage.EventKey) && requestMessage.EventKey.StartsWith("qrscene_")) { parentOpenId = requestMessage.EventKey.Replace("qrscene_", "");//推荐人的openid if (openId != parentOpenId) { //给推荐人发送推荐成功消息 string notifyMsg = string.Format(@"用户【{0}】,通过您的二维码加入了商城,加入时间:{1}", userInfo.nickname, DateTime.Now.ToString()); var customService = new CustomService(); customService.SendText(parentOpenId, notifyMsg); } } //将新关注的用户添加到数据库保存 Task.Factory.StartNew(() => { //用户信息保存到数据库 var userGenerator = new UserGenerator(); userGenerator.CreateUser(new Models.UserInfo { OpenId = openId, UnionId = userInfo.unionid, NickName = userInfo.nickname, Province = userInfo.province, City = userInfo.city, County = userInfo.country, Gender = userInfo.sex.ToString(), Portrait = userInfo.headimgurl, ParentOpenId = parentOpenId }); }); return(responseMessage); }
public void User_Delete() { // data var userData = new UserGenerator(); // page objects var mainMenu = new MainMenu(_driver); var userMenu = new SubMenuUsers(_driver); var userPages = new UserPages(_driver); try { _test.Log(LogStatus.Info, "Creating user"); userData.CreateInDatabase(); // delete the user mainMenu.ClickUsers(); userMenu.ClickUsersList(); _driver.SwitchToFrameById("MainContentsIFrame"); userPages.ListUsersPage.MarkItem(userData.Id.ToString()); _test.Log(LogStatus.Info, "Select user"); userPages.ListUsersPage.ClickDeleteUser(); _test.Log(LogStatus.Info, "Click delete"); userPages.ListUsersPage.ConfirmDeletion(); _test.Log(LogStatus.Info, "Click 'Yes' to delete the user"); // Navigate back to the List all users page // This is to get around a bug in the system which causes the deleted user to be displayed until page is refreshed mainMenu.ClickMainMenuTab(); mainMenu.ClickUsers(); userMenu.ClickUsersList(); _driver.SwitchToFrameById("MainContentsIFrame"); Assert.IsFalse(userPages.ListUsersPage.ItemFound(userData.Id.ToString()), "User was not deleted"); _test.Log(LogStatus.Pass, "The user was deleted successfully"); } catch (Exception e) { HandleException(e, _driver); throw; } }
public void CreateTeachersTest() { foreach (var teacher in this.demoStorage.GetTeachers()) { Assert.IsNull(this.tests.Storage.GetUser(teacher.Username)); } UserGenerator.Generate(this.tests.Storage, this.demoStorage); foreach (var teacher in this.demoStorage.GetTeachers()) { Assert.AreEqual(1, this.tests.Storage.GetUsersInRole(Common.Models.Role.Teacher).Count(u => u.Username == teacher.Username)); } UserGenerator.Generate(this.tests.Storage, this.demoStorage); foreach (var user in this.demoStorage.GetTeachers()) { Assert.AreEqual(1, this.tests.Storage.GetUsers(u => u.Username == user.Username).Count()); } }
/// <summary> /// 获取需要仿真的用户集合 /// </summary> private void InitialUsers() { UserGenerator userGen = new UserGenerator(m_TrafficMaps, m_ScalingFactor); m_Users = userGen.GenerateUsers(); m_SnapshotContext.AddKey(ContextKeys.PreAccessUsers, new List<User>()); m_SnapshotContext.AddKey(ContextKeys.AccessFailedPolyModelUsers, new List<User>()); m_SnapshotContext.AddKey(ContextKeys.FailedThreshold, new FailedThreshold()); }