Exemplo n.º 1
0
        public void CanRegisterLoginAndDeleteUser()
        {
            Assume.That(adminDataApiClient.IsAvailable(), "API not available");
            var dataApiClient = new DataApiClient(ApiSetup.ApiConfiguration);

            var username  = UserGenerator.GenerateUsername();
            var password  = UserGenerator.GeneratePassword();
            var email     = $"{username}@example.org";
            var firstName = "Jamie";
            var lastName  = "Doe";

            Assert.That(() => dataApiClient.Register(username, firstName, lastName, password, email), Throws.Nothing);
            AuthenticationResult authenticationResult = null;

            Assert.That(() => authenticationResult = dataApiClient.Login(username, password), Throws.Nothing);
            Assert.That(authenticationResult.IsAuthenticated, Is.True);
            Assert.That(() => dataApiClient.DeleteUser(username), Throws.Nothing);
            dataApiClient.Logout();
            Assert.That(() => authenticationResult = dataApiClient.Login(username, password), Throws.Nothing);
            Assert.That(authenticationResult.IsAuthenticated, Is.False);
        }