public void CoreUsermanagerClientProxyTest() { Message.PrintLine("This test requires a heart server to be running on port 80 of the localhost", ConsoleColor.Yellow); ConsoleLogger logger = new ConsoleLogger() { AddDetails = false }; logger.StartLoggingThread(); // get proxies ProxyFactory factory = new ProxyFactory(); CoreClient coreClient = new CoreClient("Bam.Net", "CoreServicesTestApp", "localhost", 80, logger); UserRegistryService userService = coreClient.UserRegistryService; Expect.IsNotNull(userService); Expect.AreSame(coreClient, userService.Property("ApiKeyResolver")); Expect.AreSame(coreClient, userService.Property("ClientApplicationNameProvider")); bool? initFailed = false; coreClient.InitializationFailed += (o, a) => { initFailed = true; }; coreClient.Initialized += (o, a) => { initFailed = false; }; coreClient.RegisterApplicationProcess(); Expect.IsTrue(initFailed.Value); Expect.AreEqual("You must be logged in to do that", coreClient.Message); // sign up string email = $"{8.RandomLetters()}@threeheadz.com"; string userName = 5.RandomLetters(); string passHash = "password".Sha1(); SignUpResponse signupResponse = userService.SignUp(email, userName, passHash, false); Expect.IsTrue(signupResponse.Success, signupResponse.Message); if (!signupResponse.Success) { Message.PrintLine("Message: {0}", signupResponse.Message); } else { OutLine(signupResponse.TryPropertiesToString(), ConsoleColor.Cyan); } LoginResponse loginResponse = userService.Login(userName, passHash); Expect.IsTrue(loginResponse.Success, "Unable to login to userService"); string youSayIAm = userService.WhoAmI(); Expect.AreEqual(userName, youSayIAm); loginResponse = coreClient.ApplicationRegistryService.Login(userName, passHash); Expect.IsTrue(loginResponse.Success, "Unable to login to application registry service"); Expect.IsTrue(coreClient.RegisterApplicationProcess(), coreClient.Message); Expect.IsFalse(initFailed.Value); Expect.IsTrue(File.Exists(coreClient.ApiKeyFilePath)); Pass("No exceptions were thrown and all assertions passed"); }
public LoginResponse Login(string userName, string passHash) { return(UserRegistryService.Login(userName, passHash)); }