public override async Task TestScenarioSetUp(ContactTestData testData) { //create an accountmaster AccountMasterRequest accountMasterRequest = new AccountMasterRequest { Identifier = testData.AccountMasterExtId, CreateAccount = true, IsWebEnabled = true, CreatedBy = "post request 01", Name = "temporal AM" }; await Client.AccountMasters.Create(accountMasterRequest); //create contact ContactRequest contactRequest = new ContactRequest { CreatedBy = "post request 01", ExternalIdentifier = testData.ExternalIdentifier, AccountMasterExtId = accountMasterRequest.Identifier, ContactEmail = "*****@*****.**", FirstName = "john", LastName = "doe", PhoneNumber = "1234567890" }; await Client.Contacts.Create(contactRequest); }
public async Task PUT_AccountMaster_Not_Found() { string externalIdentifier = "putAccountMasterCase03"; AccountMasterRequest request = new AccountMasterRequest { CreateAccount = true, UseAccountTermsAsDefaultPayment = true, TaxIdentifier = "asd", UpdatedBy = "http test", ExternalData = "nada", GroupIdentifier = "asd", Identifier = externalIdentifier, IsWebEnabled = true, Name = "http test", ProductPriceDiscount = 105, TermsConfiguration = new AccountMasterTermConfiguration { HasPaymentTerms = true, TermsDescription = "29 days ;)" } }; HttpResponseExtended <AccountMasterResponse> response = await Client.AccountMasters.Update(externalIdentifier, request); //validations Assert.IsNotNull(response); Assert.AreEqual(404, response.StatusCode); Assert.IsFalse(response.Success); Assert.IsNull(response.Result); }
//TODO //when not found the response is a string //[TestMethod] //public async Task DELETE_Address_NotFound() public override async Task TestScenarioSetUp(AddressTestData testData) { AccountMasterRequest accountMasterRequest = new AccountMasterRequest { Identifier = testData.AccountMasterExtId, Name = "temporal request helper", CreateAccount = false, IsWebEnabled = true, CreatedBy = "temporal request", TermsConfiguration = new AccountMasterTermConfiguration { HasPaymentTerms = true, TermsDescription = "Net 15 days" } }; AddressRequest addressRequest = new AddressRequest { Identifier = testData.ExternalIdentifier, Name = "temporal address", AddressLine = "elm street", AddressLine2 = "1", City = "denver", Country = "US", State = "Colorado", Postal = "1234567890" }; await Client.AccountMasters.Create(accountMasterRequest); await Client.Addresses.Create(testData.AccountMasterExtId, addressRequest); }
public LoginModel CreateLoginAccount(string email = "*****@*****.**", string accountExternalId = "1234") { //Remove any account matching the given email Processor.ClearUserLoginByEmail(email).Wait(); string accountMasterExternalId = accountExternalId; string loginEmail = email; //Create an Account Master and an Account asociated with it AccountMasterRequest accountMasterRequest = new AccountMasterRequest { CreateAccount = true, UseAccountTermsAsDefaultPayment = true, TaxIdentifier = "asd", CreatedBy = System.Security.Principal.WindowsIdentity.GetCurrent().Name, ExternalData = "nada", GroupIdentifier = "asd", Identifier = accountExternalId, IsWebEnabled = true, Name = "Softtek http test", ProductPriceDiscount = 105, TermsConfiguration = new AccountMasterTermConfiguration { HasPaymentTerms = true, TermsDescription = "29 days ;)" } }; var resp = IntegrationsClient.AccountMasters.Create(accountMasterRequest).Result; //Get the Account created by the Above Method GetAccountAccountMasterRequest getAccountAccountMasterRequest = new GetAccountAccountMasterRequest { externalId = accountMasterExternalId }; var getAccountAccountMasterResponse = CustomerServiceClient.Logins.GetAccountByAccountMasterExternalId(getAccountAccountMasterRequest).Result; //Create a Login/User/Contact providing the AccountMaster and the Account Identifier CreateLoginUserContactRequest createLoginUserContactRequest = new CreateLoginUserContactRequest { AccountIdentifier = getAccountAccountMasterResponse.Result.AccountIdentifier, AccountMasterIdentifier = getAccountAccountMasterResponse.Result.AccountMasterIdentifier, ConfirmPassword = "******", Password = "******", ContactEmail = "*****@*****.**", Email = loginEmail, FirstName = "Softtek", LastName = "Test User", PlatformIdentifier = new Guid(PlatformIdentifier), PhoneNumber = "123456789" }; var createLoginUserContactResponse = CustomerServiceClient.Logins.CreateContactUserLogin(createLoginUserContactRequest).Result; return(new LoginModel { Email = email, Password = "******" }); }
//TODO //pending //[TestMethod] public async Task POST_Verify_PriceList_Order() { string externalIdentifier = "postAccountMasterCase01"; AccountMasterTestData testData = new AccountMasterTestData { ExternalIdentifier = externalIdentifier }; //TODO: //review this validation IDictionary <int, string> priceListItems = new Dictionary <int, string> { { 0, "priceList01" }, { 1, "priceList04" }, { 2, "priceList02" }, { 3, "priceList03" } }; AccountMasterRequest request = new AccountMasterRequest { CreateAccount = true, UseAccountTermsAsDefaultPayment = true, TaxIdentifier = "asd", CreatedBy = "http test", ExternalData = "nada", GroupIdentifier = "asd", Identifier = externalIdentifier, IsWebEnabled = true, Name = "http test", ProductPriceDiscount = 105, TermsConfiguration = new AccountMasterTermConfiguration { HasPaymentTerms = true, TermsDescription = "29 days ;)" }, PriceListIds = new List <string> { "" } }; HttpResponseExtended <AccountMasterResponse> response = await Client.AccountMasters.Create(request); //validations Assert.IsNotNull(response); Assert.AreEqual(200, response.StatusCode); Assert.IsTrue(response.Success); Assert.IsNotNull(response.Result); //NOTE //the result.PriceLists will return a list of external ids //test scenario clean up await TestScenarioCleanUp(testData); }
public override async Task TestScenarioSetUp(AccountMasterTestData testData) { AccountMasterRequest accountMasterRequest = new AccountMasterRequest { Name = "temporal name", IsWebEnabled = true, CreateAccount = false, Identifier = testData.ExternalIdentifier, CreatedBy = "temporal request" }; await Client.AccountMasters.Create(accountMasterRequest); }
//[TestMethod] //public async Task PUT_User_Success() //[TestMethod] //public async Task PUT_User_NotFound() public override async Task TestScenarioSetUp(UserTestData testData) { //create an accountmaster AccountMasterRequest accountMasterRequest = new AccountMasterRequest { Identifier = testData.AccountMasterExtId, CreateAccount = true, IsWebEnabled = true, CreatedBy = "temporal request", Name = "temporal Account Master" }; await Client.AccountMasters.Create(accountMasterRequest); //create login LoginRequest loginRequest = new LoginRequest { CreatedBy = "temporal req", ExternalIdentifier = testData.LoginExtId, IsEnabled = true, UserName = "******", Email = "*****@*****.**", PasswordHash = "", //todo PasswordSalt = "" //todo }; await Client.Logins.Create(loginRequest); //create contact ContactRequest contactRequest = new ContactRequest { CreatedBy = "temporal request", ExternalIdentifier = testData.ContactExtId, AccountMasterExtId = accountMasterRequest.Identifier, ContactEmail = "*****@*****.**", FirstName = "john", LastName = "doe", PhoneNumber = "1234567890" }; await Client.Contacts.Create(contactRequest); //create user UserRequest userRequest = new UserRequest { CreatedBy = "post request 01", AccountMasterExtId = testData.AccountMasterExtId, ContactExtId = testData.ContactExtId, ExternalIdentifier = testData.ExternalIdentifier, IsEnabled = true, LoginExtId = testData.LoginExtId }; await Client.Users.Create(userRequest); }
public async Task PUT_AccountMaster_Success() { string externalIdentifier = "putAccountMaster01"; //test scenario setup AccountMasterTestData testData = new AccountMasterTestData { ExternalIdentifier = externalIdentifier }; await TestScenarioSetUp(testData); AccountMasterRequest request = new AccountMasterRequest { CreateAccount = true, UseAccountTermsAsDefaultPayment = true, TaxIdentifier = "asd", UpdatedBy = "http test", ExternalData = "nada", GroupIdentifier = "asd", Identifier = externalIdentifier, IsWebEnabled = true, Name = "http test", ProductPriceDiscount = 105, TermsConfiguration = new AccountMasterTermConfiguration { HasPaymentTerms = true, TermsDescription = "29 days ;)" } }; HttpResponseExtended <AccountMasterResponse> response = await Client.AccountMasters.Update(externalIdentifier, request); //validations Assert.IsNotNull(response); Assert.AreEqual(200, response.StatusCode); Assert.IsTrue(response.Success); Assert.IsNotNull(response.Result); //TODO //add updated properties Assert.AreEqual(request.UpdatedBy, response.Result.UpdatedBy); //test scenario clean up await TestScenarioCleanUp(testData); }
public async Task POST_Contact_Success() { string externalIdentifier = "postContactSuccess01"; ContactTestData testData = new ContactTestData { ExternalIdentifier = externalIdentifier, AccountMasterExtId = "accountMasterExtId01" }; //create an accountmaster first AccountMasterRequest accountMasterRequest = new AccountMasterRequest { Identifier = testData.AccountMasterExtId, CreateAccount = true, IsWebEnabled = true, CreatedBy = "post request 01", Name = "temporal AM" }; var accountMasterResponse = await Client.AccountMasters.Create(accountMasterRequest); ContactRequest request = new ContactRequest { CreatedBy = "post request 01", ExternalIdentifier = externalIdentifier, AccountMasterExtId = accountMasterRequest.Identifier, ContactEmail = "*****@*****.**", FirstName = "john", LastName = "doe", PhoneNumber = "1234567890" }; HttpResponseExtended <ContactResponse> response = await Client.Contacts.Create(request); //validations Assert.IsNotNull(response, "Response object should not be null"); Assert.AreEqual(200, response.StatusCode); Assert.IsNotNull(response.Result, "Result object should not be null"); //test scenario clean up await TestScenarioCleanUp(testData); }
public async Task POST_Address_Success() { //test scenario setup AddressTestData testData = new AddressTestData { ExternalIdentifier = "postAddress01", AccountMasterExtId = "postAddressAccountMaster01" }; AccountMasterRequest accountMasterRequest = new AccountMasterRequest { Identifier = testData.AccountMasterExtId, CreateAccount = false, Name = "temporal account master", IsWebEnabled = true, CreatedBy = "temporal request" }; //create accountmaster await Client.AccountMasters.Create(accountMasterRequest); AddressRequest addressRequest = new AddressRequest { AddressLine = "Elm street, 23", AddressLine2 = "", City = "boulder", Country = "US", Identifier = testData.ExternalIdentifier, Name = "Temporal name", Postal = "28790", State = "colorado" }; AddressResponse response = await Client.Addresses.Create(testData.AccountMasterExtId, addressRequest); Assert.IsNotNull(response, "Response should not be null"); //test scenario clean up await TestScenarioCleanUp(testData); }
public async Task <TestUserAccount> CreateUserAccount(TestUserAccount createUserRequest = null) { //default account var testUserAccount = createUserRequest ?? new TestUserAccount { Email = "*****@*****.**", ContactInformation = new TestContactInformation { CompanyName = "SDET", FirstName = "John", LastName = "Doe", PhoneNumber = "9876543210", Email = "*****@*****.**" }, AccountExternalIds = new TestExternalIdentifiers { LoginExtId = "testLogin-123", AccountMasterExtId = "testAccountMaster-123", ContactExtId = "testContact-123", UserExtId = "testUser-123" } }; //validate given data if (createUserRequest != null) { ValidateUserData(createUserRequest); } //clear all account related data await RemoveUserAccount(testUserAccount.AccountExternalIds); //create account and accountmaster AccountMasterRequest createAccountMasterRequest = new AccountMasterRequest { CreatedBy = System.Security.Principal.WindowsIdentity.GetCurrent().Name, Identifier = testUserAccount.AccountExternalIds.AccountMasterExtId, Name = testUserAccount.ContactInformation.CompanyName, CreateAccount = true, IsWebEnabled = true }; var createAccountMasterResponse = await _client.AccountMasters.Create(createAccountMasterRequest); if (!createAccountMasterResponse.Success) { throw new Exception($"Test user cannot be created, check accountmaster creation process ({createAccountMasterRequest.Identifier})"); } //create contact ContactRequest contactRequest = new ContactRequest { CreatedBy = System.Security.Principal.WindowsIdentity.GetCurrent().Name, ExternalIdentifier = testUserAccount.AccountExternalIds.ContactExtId, AccountMasterExtId = testUserAccount.AccountExternalIds.AccountMasterExtId, ContactEmail = testUserAccount.ContactInformation.Email, FirstName = testUserAccount.ContactInformation.FirstName, LastName = testUserAccount.ContactInformation.LastName, PhoneNumber = testUserAccount.ContactInformation.PhoneNumber }; var createContactResponse = await _client.Contacts.Create(contactRequest); if (!createContactResponse.Success) { throw new Exception("Test contact cannot be created, please check the given contact info. data"); } //create login LoginRequest createLoginRequest = new LoginRequest { CreatedBy = System.Security.Principal.WindowsIdentity.GetCurrent().Name, ExternalIdentifier = testUserAccount.AccountExternalIds.LoginExtId, IsEnabled = true, UserName = testUserAccount.Username, Email = testUserAccount.Email, PasswordHash = "E95FBFCD1C6EB3CA80DCE1F656633017", //password -> 1234 PasswordSalt = "xXJnoJE=" //password -> 1234 }; var loginResponse = await _client.Logins.Create(createLoginRequest); if (!loginResponse.Success) { throw new Exception("Test login cannot be created, check logins endpoint method"); } //create user UserRequest userRequest = new UserRequest { CreatedBy = System.Security.Principal.WindowsIdentity.GetCurrent().Name, AccountMasterExtId = testUserAccount.AccountExternalIds.AccountMasterExtId, ContactExtId = testUserAccount.AccountExternalIds.ContactExtId, ExternalIdentifier = testUserAccount.AccountExternalIds.UserExtId, IsEnabled = true, LoginExtId = testUserAccount.AccountExternalIds.LoginExtId }; var createUserResponse = await _client.Users.Create(userRequest); if (!createUserResponse.Success) { throw new Exception($"Test user cannot be created, check user post endpoint method"); } return(testUserAccount); }
public async Task POST_User_Success() { string userExtId = "postUser01"; UserTestData testData = new UserTestData { ExternalIdentifier = userExtId, ContactExtId = "postUserContact01", AccountMasterExtId = "postUserSuccess01", LoginExtId = "postUserLogin01" }; //create an accountmaster AccountMasterRequest accountMasterRequest = new AccountMasterRequest { Identifier = testData.AccountMasterExtId, CreateAccount = true, IsWebEnabled = true, CreatedBy = "temporal request", Name = "temporal Account Master" }; await Client.AccountMasters.Create(accountMasterRequest); //create login LoginRequest loginRequest = new LoginRequest { CreatedBy = "temporal req", ExternalIdentifier = testData.LoginExtId, IsEnabled = true, UserName = "******", Email = "*****@*****.**", PasswordHash = "", //todo PasswordSalt = "" //todo }; await Client.Logins.Create(loginRequest); //create contact ContactRequest contactRequest = new ContactRequest { CreatedBy = "temporal request", ExternalIdentifier = testData.ContactExtId, AccountMasterExtId = accountMasterRequest.Identifier, ContactEmail = "*****@*****.**", FirstName = "john", LastName = "doe", PhoneNumber = "1234567890" }; await Client.Contacts.Create(contactRequest); UserRequest userRequest = new UserRequest { CreatedBy = "post request 01", AccountMasterExtId = testData.AccountMasterExtId, ContactExtId = testData.ContactExtId, ExternalIdentifier = userExtId, IsEnabled = true, LoginExtId = testData.LoginExtId }; HttpResponseExtended <UserResponse> response = await Client.Users.Create(userRequest); //validations Assert.IsNotNull(response, "Response object should not be null"); Assert.AreEqual(200, response.StatusCode); Assert.IsNotNull(response.Result, "Result object should not be null"); //test scenario clean up await TestScenarioCleanUp(testData); }
private async Task CreateUserFullPath(TestUserAccount userAccountData) { //create account and accountmaster AccountMasterRequest createAccountMasterRequest = new AccountMasterRequest { CreatedBy = System.Security.Principal.WindowsIdentity.GetCurrent().Name, Identifier = userAccountData.AccountExternalIds.AccountMasterExtId, Name = userAccountData.ContactInformation.CompanyName, CreateAccount = true, IsWebEnabled = true }; var createAccountMasterResponse = await _client.AccountMasters.Create(createAccountMasterRequest); if (!createAccountMasterResponse.Success) { throw new Exception($"Test user cannot be created, check accountmaster creation process ({createAccountMasterRequest.Identifier})"); } //create contact ContactRequest contactRequest = new ContactRequest { CreatedBy = System.Security.Principal.WindowsIdentity.GetCurrent().Name, ExternalIdentifier = userAccountData.AccountExternalIds.ContactExtId, AccountMasterExtId = userAccountData.AccountExternalIds.AccountMasterExtId, ContactEmail = userAccountData.ContactInformation.Email, FirstName = userAccountData.ContactInformation.FirstName, LastName = userAccountData.ContactInformation.LastName, PhoneNumber = userAccountData.ContactInformation.PhoneNumber }; var createContactResponse = await _client.Contacts.Create(contactRequest); if (!createContactResponse.Success) { throw new Exception("Test contact cannot be created, please check the given contact info. data"); } //create login LoginRequest createLoginRequest = new LoginRequest { CreatedBy = System.Security.Principal.WindowsIdentity.GetCurrent().Name, ExternalIdentifier = userAccountData.AccountExternalIds.LoginExtId, IsEnabled = true, UserName = userAccountData.Username, Email = userAccountData.Email, PasswordHash = "E95FBFCD1C6EB3CA80DCE1F656633017", //password -> 1234 PasswordSalt = "xXJnoJE=" //password -> 1234 }; var loginResponse = await _client.Logins.Create(createLoginRequest); if (!loginResponse.Success) { throw new Exception("Test login cannot be created, check logins endpoint method"); } //create user UserRequest userRequest = new UserRequest { CreatedBy = System.Security.Principal.WindowsIdentity.GetCurrent().Name, AccountMasterExtId = userAccountData.AccountExternalIds.AccountMasterExtId, ContactExtId = userAccountData.AccountExternalIds.ContactExtId, ExternalIdentifier = userAccountData.AccountExternalIds.UserExtId, IsEnabled = true, LoginExtId = userAccountData.AccountExternalIds.LoginExtId }; var createUserResponse = await _client.Users.Create(userRequest); if (!createUserResponse.Success) { throw new Exception($"Test user cannot be created, check user post endpoint method"); } }