// happy path
        public async Task WhenArgumentsValid_ReturnsNewSessionId()
        {
            // Act
            var result = await _client.CreateSessionId(ValidatedToken);

            var session = JsonConvert.DeserializeObject <SessionIdResponseModel>(result.Json);

            SessionToDispose = session.SessionId;

            // Assert
            Assert.True(result.HttpStatusCode == System.Net.HttpStatusCode.OK);
            Assert.True(session.Success);
            Assert.False(string.IsNullOrWhiteSpace(session.SessionId));
            _output.WriteLine($"Session id created: {session.SessionId}");
        }
Beispiel #2
0
        // Setup steps:
        // -(1) set up a new unused request token
        // -(2) Validate the request token
        // -(3) Create a new session
        public async Task InitializeAsync()
        {
            var tokenResponse = await _client.CreateRequestToken();

            var token = JsonConvert.DeserializeObject <RequestToken>(tokenResponse.Json);
            await _client.ValidateRequestTokenWithLogin
                (_settings.AccountName, _settings.Password, token.Token);

            var createSessionIdResult = await _client.CreateSessionId(token.Token);

            SessionId = JsonConvert.DeserializeObject <SessionIdResponseModel>(createSessionIdResult.Json).SessionId;
        }
        public async Task InitializeAsync()
        {
            try
            {
                var tokenResponse = await _client.CreateRequestToken();

                var token = JsonConvert.DeserializeObject <RequestToken>(tokenResponse.Json);
                await _client.ValidateRequestTokenWithLogin
                    (_settings.AccountName, _settings.Password, token.Token);

                var createSessionIdResult = await _client.CreateSessionId(token.Token);

                SessionId = JsonConvert.DeserializeObject <SessionIdResponseModel>(createSessionIdResult.Json).SessionId;
                _output.WriteLine($"{nameof(InitializeAsync)}: Session \"{SessionId}\" created");
            }
            catch (Exception ex)
            {
                _output.WriteLine(ex.Message);
                _output.WriteLine(ex.StackTrace);
            }
        }