public void CredsFromProfileTest() { var parser = new FileIniDataParser(); string ini = @" [unittest] sender_id = inisenderid sender_password = inisenderpass endpoint_url = https://unittest.intacct.com/ia/xmlgw.phtml"; string tempFile = Path.Combine(Path.GetTempPath(), ".intacct", "credentials.ini"); using (StreamWriter sw = new StreamWriter(tempFile)) { sw.WriteLine(ini); } SdkConfig config = new SdkConfig() { ProfileFile = tempFile, ProfileName = "unittest", }; SenderCredentials senderCreds = new SenderCredentials(config); Assert.AreEqual("inisenderid", senderCreds.SenderId); Assert.AreEqual("inisenderpass", senderCreds.Password); Assert.AreEqual("https://unittest.intacct.com/ia/xmlgw.phtml", senderCreds.Endpoint.Url); }
public void CredsFromArrayNoSenderPasswordTest() { SdkConfig config = new SdkConfig { SenderId = "testsenderid" }; SenderCredentials senderCreds = new SenderCredentials(config); }
public LoginCredentialsTest() { ClientConfig config = new ClientConfig { SenderId = "testsenderid", SenderPassword = "******" }; this.SenderCreds = new SenderCredentials(config); }
public void Initialize() { SdkConfig config = new SdkConfig { SenderId = "testsenderid", SenderPassword = "******" }; senderCreds = new SenderCredentials(config); }
public void CredsFromEnvTest() { Environment.SetEnvironmentVariable("INTACCT_SENDER_ID", "envsender"); Environment.SetEnvironmentVariable("INTACCT_SENDER_PASSWORD", "envpass"); ClientConfig config = new ClientConfig(); SenderCredentials senderCreds = new SenderCredentials(config); Assert.Equal("envsender", senderCreds.SenderId); Assert.Equal("envpass", senderCreds.Password); Environment.SetEnvironmentVariable("INTACCT_SENDER_ID", null); Environment.SetEnvironmentVariable("INTACCT_SENDER_PASSWORD", null); }
public void CredsFromArrayTest() { ClientConfig config = new ClientConfig { SenderId = "testsenderid", SenderPassword = "******", EndpointUrl = "https://unittest.intacct.com/ia/xml/xmlgw.phtml" }; SenderCredentials senderCreds = new SenderCredentials(config); Assert.Equal("testsenderid", senderCreds.SenderId); Assert.Equal("pass123!", senderCreds.Password); Assert.Equal("https://unittest.intacct.com/ia/xml/xmlgw.phtml", senderCreds.Endpoint.ToString()); }
public void CredsFromProfileTest() { string tempFile = Path.Combine(Directory.GetCurrentDirectory(), "Credentials", "Ini", "default.ini"); ClientConfig config = new ClientConfig() { ProfileFile = tempFile, ProfileName = "anothertest", }; SenderCredentials senderCreds = new SenderCredentials(config); Assert.Equal("inisenderid", senderCreds.SenderId); Assert.Equal("inisenderpass", senderCreds.Password); Assert.Equal("https://unittest.intacct.com/ia/xmlgw.phtml", senderCreds.Endpoint.Url); }
private async Task InitializeAsync(SdkConfig config) { if (String.IsNullOrWhiteSpace(config.ProfileName)) { config.ProfileName = Environment.GetEnvironmentVariable(ProfileEnvName); } SessionProvider provider = new SessionProvider(); SenderCredentials senderCreds = new SenderCredentials(config); if (!String.IsNullOrWhiteSpace(config.SessionId)) { SessionCredentials session = new SessionCredentials(config, senderCreds); sessionCreds = await provider.FromSessionCredentials(session); } else { LoginCredentials login = new LoginCredentials(config, senderCreds); sessionCreds = await provider.FromLoginCredentials(login); } }