public void TestCreateSessionFromPassword() { using (var _server = new UnitTestSkyDoxServer(1344)) { _server.NextResponse.Enqueue(MockResponse.user_sessions_SuccessDeviceTokenValidated); DoxApi doxApi = new DoxApi(_apiUrl); string user = string.Format(_rootEmail, "validated-personal"); var session = doxApi.CreateSessionFromPassword(user, "Workshare1", null); Assert.NotNull(session); Assert.IsNotNullOrEmpty(session.Credentials.DeviceToken); } }
public void TestSetCredentialsForUserThatAlreadyExistsButIsntValidated() { using (var _server = new UnitTestSkyDoxServer(1344)) { _server.NextResponse.Enqueue(MockResponse.sign_ups_Success); DoxApi doxApi = new DoxApi(_apiUrl); string user = string.Format(_rootEmail, "unvalidated-personal"); string password = "******"; Assert.True(doxApi.SetCredentials(user, password, null)); Assert.Null(doxApi.Error); } }
public void TestRegisterNonExistantUser() { using (var _server = new UnitTestSkyDoxServer(1344)) { _server.NextResponse.Enqueue(MockResponse.sign_ups_Success); DoxApi doxApi = new DoxApi(_apiUrl); string user = string.Format(_rootEmail, Guid.NewGuid().ToString("N")); string password = "******"; Assert.True(doxApi.RegisterUser(user, password, null)); Assert.Null(doxApi.Error); } }
//[Test] public void TestSignupAsAUserThatAlreadyExistsAndIsValidated() { using (var _server = new UnitTestSkyDoxServer(1344)) { _server.NextResponse.Enqueue(MockResponse.sign_ups_UserAlreadyExists); DoxApi doxApi = new DoxApi(_apiUrl); string user = string.Format(_rootEmail, "validated-personal"); string password = "******"; Assert.False(doxApi.RegisterUser(user, password, null)); Assert.NotNull(doxApi.Error); Assert.AreEqual(doxApi.Error.HttpStatus, 409); Assert.AreEqual(doxApi.Error.Message, "Email address already registered"); } }
//[Test] public void TestCreateSessionFromPassword_UnvalidatedUser_Before() { using (var _server = new UnitTestSkyDoxServer(1344)) { _server.NextResponse.Enqueue(MockResponse.user_sessions_Unvalidated); DoxApi doxApi = new DoxApi(_apiUrl); string user = string.Format(_rootEmail, "unvalidated-personal"); var session = doxApi.CreateSessionFromPassword(user, "Workshare1", null); Assert.IsNull(session); Assert.NotNull(doxApi.Error); Assert.NotNull(doxApi.Error.Message); Assert.True(doxApi.Error.Message.Contains("hasn't been validated yet")); } }
public void TestCreateSessionFromDeviceToken_Unvalidated_After() { using (var _server = new UnitTestSkyDoxServer(1344)) { DoxApi doxApi = new DoxApi(_apiUrl); _server.NextResponse.Enqueue(MockResponse.user_sessions_SuccessDeviceTokenUnvalidated); _server.NextResponse.Enqueue(MockResponse.current_user_NotValidated); string user = string.Format(_rootEmail, "unvalidated-personal"); ApiHelper apiHelper = new ApiHelper(); var session = doxApi.CreateSessionFromPassword(user, "Workshare1", apiHelper); Assert.IsNotNullOrEmpty(session.Credentials.DeviceToken); session = doxApi.CreateSessionFromDeviceToken(user, session.Credentials.DeviceToken, apiHelper); Assert.NotNull(session); } }