public void UserLogin() { var captcha = serverClient.GetCaptchaImage(); // 你应该在这里转换为图像,然后输入正确的验证码 // 测试服务器不会验证验证码是否正确 try { serverClient.Register("testuser1", "*****@*****.**", "123456", "TestUser1", null, "xxxx"); } catch (Exception e) { } Assert.False(serverClient.Login("testuser1", "654321", "xxxx")); var success = serverClient.Login("testuser1", "123456", "xxxx"); Assert.True(success); Assert.False(string.IsNullOrEmpty(serverClient.UserSession)); Assert.NotZero(serverClient.UID); }