public void Login_WithEmptyBody_ReturnsBadRequest() { var authClient = ApiClientFactory.GetClient <AuthorizationClient>(); var response = authClient.LoginWithEmptyBody(); Assert.AreEqual(response.StatusCode, HttpStatusCode.BadRequest); Assert.AreEqual(response.Data.Title, "One or more validation errors occurred."); Assert.IsTrue(response.Data.Errors.ErrorsList.Contains("A non-empty request body is required.")); }
public void GetAllCategories() { var authClient = ApiClientFactory.GetClient<CategoriesClient>(); var response = authClient.GetCategories(); Assert.AreEqual(response.StatusCode, HttpStatusCode.OK); Assert.IsTrue(response.Data.Categories.Count > 0); Assert.IsTrue(response.Data.Categories.Any(c => c.Name.Equals("Football"))); }
public void RegisterUser_WithEmptyFields_ReturnsBadRequest() { var user = new User { Login = null, Password = null }; var authClient = ApiClientFactory.GetClient <AuthorizationClient>(user); var response = authClient.Register(user); Assert.IsNull(response.Data.Token); Assert.AreEqual(response.StatusCode, HttpStatusCode.BadRequest); Assert.IsFalse(response.Data.Success); Assert.IsTrue(response.Data.Message.Equals("Incorrect login or password")); }
public void RegisterExistingUser_ReturnsBadRequest() { var user = new User { Login = "******", Password = "******" }; var authClient = ApiClientFactory.GetClient <AuthorizationClient>(user); var response = authClient.Register(user); Assert.IsNull(response.Data.Token); Assert.AreEqual(response.StatusCode, HttpStatusCode.BadRequest); Assert.IsFalse(response.Data.Success); Assert.IsTrue(response.Data.Message.Equals("User already exists")); }
public void Login_WithEmptyLogin(string email, string password) { var user = new User { Login = email, Password = password }; var authClient = ApiClientFactory.GetClient <AuthorizationClient>(user); var response = authClient.Login <AuthResponse>(user); Assert.IsNull(response.Data.Token); Assert.AreEqual(response.StatusCode, HttpStatusCode.BadRequest); Assert.IsFalse(response.Data.Success); Assert.IsTrue(response.Data.Message.Equals("Incorrect login or password")); }
public void RegisterUser_WithRightCredentialsPassed_ReturnsToken() { var user = new User { Login = DataGenerator.GenerateEmail(), Password = "******" }; var authClient = ApiClientFactory.GetClient <AuthorizationClient>(user); var response = authClient.Register(user); Assert.AreEqual(response.StatusCode, HttpStatusCode.Created); Assert.IsTrue(response.Data.Message.Equals("Registred and generated token")); Assert.IsTrue(response.Data.Success); Assert.NotNull(response.Data.Token); Assert.IsTrue(response.Data.Token.Contains("Bearer")); }
public void Login_WithRightCredentials_ReturnsUserToken() { var user = new User { Login = "******", Password = "******" }; var authClient = ApiClientFactory.GetClient <AuthorizationClient>(user); var response = authClient.Login <AuthResponse>(user); Assert.AreEqual(response.StatusCode, HttpStatusCode.OK); Assert.IsTrue(response.Data.Message.Equals("New token has been generated")); Assert.IsTrue(response.Data.Success); Assert.NotNull(response.Data.Token); Assert.IsTrue(response.Data.Token.Contains("Bearer")); }
public void RegisterNewUser_LoginWithCreatedUser_ReturnsTokenAndOkStatus() { var user = new User { Login = DataGenerator.GenerateEmail(), Password = "******" }; Console.WriteLine($"USER:\nlogin: {user.Login}\npass: {user.Password}"); var authClient = ApiClientFactory.GetClient <AuthorizationClient>(user); authClient.Register(user); var response = authClient.Login <AuthResponse>(user); Assert.AreEqual(response.StatusCode, HttpStatusCode.OK); Assert.IsTrue(response.Data.Message.Equals("New token has been generated")); Assert.IsTrue(response.Data.Success); Assert.NotNull(response.Data.Token); Assert.IsTrue(response.Data.Token.Contains("Bearer")); }
public DiagnosticsTester() { _client = ApiClientFactory.GetClient <IDiagnosticsClient>(); }
public DiagnosticsTester() { var config = TestConfig.Instance; _client = ApiClientFactory.GetClient <IDiagnosticsClient>(config.ApiUrl); }
public void Login(User user) { var authClient = ApiClientFactory.GetClient <AuthorizationClient>(user); authClient.Login <AuthResponse>(user); }
public ExampleTester() { _client = ApiClientFactory.GetClient <IExampleClient>(); }
public RepositoryBase(string serviceName = "DongboUser") { ServiceClient = ApiClientFactory.GetClient(serviceName); }
public void GetPostClient() { var client = instance.GetClient(); Assert.IsNotNull(client); }
public ExampleTester() { var config = TestConfig.Instance; _client = ApiClientFactory.GetClient <IExampleClient>(config.ApiUrl); }