-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This updates the Intacct SDK for .NET to be of the same design as the Intacct SDK for PHP.
- Loading branch information
1 parent
e2a0420
commit 4c0d324
Showing
689 changed files
with
16,278 additions
and
22,919 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
language: csharp | ||
solution: intacct-sdk-net.sln | ||
mono: none | ||
dotnet: 2.0.0 | ||
install: | ||
- dotnet restore | ||
|
||
script: | ||
- dotnet build --configuration Release | ||
- dotnet test Intacct.SDK.Tests/Intacct.SDK.Tests.csproj --framework "netcoreapp2.0" | ||
|
||
notifications: | ||
slack: | ||
secure: D3WkYcHFpnZoB4rFlW8Ugj04qx5Dtp1UyeQ5XtUxU4Pf1Hfu3tN5rTrsafKPVPQ57ve0vNiUb7e1xV9+YUJvFBaNvh/zJaqEE9zGHYKlt4EfnDUktYBQJ8KE0FuW+OPIkAHye/e/D598OZNFRQV+m/0JYw7Yr4xQUl8SWqgMg6x6+lQo4W1L7kTxct4avUOJ9J0NcrCl52TaHRE0SkorooYu871+euzoLOYBs6bunypKN84GY51Bvlh9CcQDjau26TzP+AV/i5zfCnQE1ihl1N40zdmAPm9iZAswPYjQVSHPDikRTnOyo37t45/+JSgikhgB+JskTNE3Gc05JdPVwl6lvtISPt8xQLDc+faHFn3CDn2rSeS8gFRQ0dzpyVDotLQELcY95R566Yf6uCtI7q5W4txjPAxnsATRh2llfs7bWXMkRNu6Rm6zXCf8NcOO5K7TAR0I/j/Up9Bk8QMOg0/P1gzgyI/Ytne5iFTTyQTv7vBa0488P2kLfSpKEbCXmQQKoquuK1Nox6fW2H/jV1S5xIx26KnctFyHLBX1u6pM3+eFHDxOWAgiXIkMMDQddjzVuw/Lbt9QpJsN5ehAuvZ+ZwAlHkC5eOwmLmmwlySeyfGP3uCpqlidy+exEby70wm1v6yKKQJGpRRcosH2xXimJChAKrw1ORh2fP0cl1Q= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Intacct.SDK.Logging; | ||
using NLog; | ||
using Xunit; | ||
|
||
namespace Intacct.SDK.Tests | ||
{ | ||
public class ClientConfigTest | ||
{ | ||
[Fact] | ||
public void ExecuteTest() | ||
{ | ||
ClientConfig clientConfig = new ClientConfig(); | ||
|
||
Assert.Null(clientConfig.ProfileFile); | ||
Assert.Null(clientConfig.ProfileName); | ||
Assert.Null(clientConfig.EndpointUrl); | ||
Assert.Null(clientConfig.SenderId); | ||
Assert.Null(clientConfig.SenderPassword); | ||
Assert.Null(clientConfig.SessionId); | ||
Assert.Null(clientConfig.CompanyId); | ||
Assert.Null(clientConfig.UserId); | ||
Assert.Null(clientConfig.UserPassword); | ||
Assert.Null(clientConfig.Credentials); | ||
Assert.Null(clientConfig.Logger); | ||
Assert.Equal(LogLevel.Debug, clientConfig.LogLevel); | ||
Assert.IsType<MessageFormatter>(clientConfig.LogMessageFormatter); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[default] | ||
sender_id = defsenderid | ||
sender_password = defsenderpass | ||
company_id = defcompanyid | ||
user_id = defuserid | ||
user_password = defuserpass | ||
endpoint_url = https://unittest.intacct.com/ia/xml/xmlgw.phtml | ||
|
||
[unittest] | ||
company_id = inicompanyid | ||
user_id = iniuserid | ||
user_password = iniuserpass | ||
|
||
[anothertest] | ||
sender_id = inisenderid | ||
sender_password = inisenderpass | ||
endpoint_url = https://unittest.intacct.com/ia/xmlgw.phtml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[notdefault] | ||
sender_id = testsenderid | ||
sender_password = testsenderpass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
/* | ||
* Copyright 2018 Sage Intacct, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not | ||
* use this file except in compliance with the License. You may obtain a copy | ||
* of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "LICENSE" file accompanying this file. This file is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
using System; | ||
using System.IO; | ||
using Intacct.SDK.Credentials; | ||
using Xunit; | ||
|
||
namespace Intacct.SDK.Tests.Credentials | ||
{ | ||
|
||
public class LoginCredentialsTest | ||
{ | ||
|
||
protected SenderCredentials SenderCreds; | ||
|
||
public LoginCredentialsTest() | ||
{ | ||
ClientConfig config = new ClientConfig | ||
{ | ||
SenderId = "testsenderid", | ||
SenderPassword = "pass123!" | ||
}; | ||
this.SenderCreds = new SenderCredentials(config); | ||
} | ||
|
||
[Fact] | ||
public void CredsFromConfigTest() | ||
{ | ||
ClientConfig config = new ClientConfig | ||
{ | ||
CompanyId = "testcompany", | ||
UserId = "testuser", | ||
UserPassword = "testpass" | ||
}; | ||
|
||
LoginCredentials loginCreds = new LoginCredentials(config, this.SenderCreds); | ||
|
||
Assert.Equal("testcompany", loginCreds.CompanyId); | ||
Assert.Equal("testuser", loginCreds.UserId); | ||
Assert.Equal("testpass", loginCreds.Password); | ||
Endpoint endpoint = loginCreds.SenderCredentials.Endpoint; | ||
Assert.Equal("https://api.intacct.com/ia/xml/xmlgw.phtml", endpoint.ToString()); | ||
Assert.IsType<SenderCredentials>(loginCreds.SenderCredentials); | ||
} | ||
|
||
[Fact] | ||
public void CredsFromProfileTest() | ||
{ | ||
string tempFile = Path.Combine(Directory.GetCurrentDirectory(), "Credentials", "Ini", "default.ini"); | ||
|
||
ClientConfig config = new ClientConfig() | ||
{ | ||
ProfileFile = tempFile, | ||
ProfileName = "unittest", | ||
}; | ||
|
||
LoginCredentials loginCreds = new LoginCredentials(config, this.SenderCreds); | ||
Assert.Equal("inicompanyid", loginCreds.CompanyId); | ||
Assert.Equal("iniuserid", loginCreds.UserId); | ||
Assert.Equal("iniuserpass", loginCreds.Password); | ||
} | ||
|
||
[Fact] | ||
public void CredsFromArrayNoCompanyIdTest() | ||
{ | ||
ClientConfig config = new ClientConfig | ||
{ | ||
CompanyId = "", | ||
UserId = "testuser", | ||
UserPassword = "testpass" | ||
}; | ||
|
||
var ex = Record.Exception(() => new LoginCredentials(config, this.SenderCreds)); | ||
Assert.IsType<ArgumentException>(ex); | ||
Assert.Equal("Required Company ID not supplied in config or env variable \"INTACCT_COMPANY_ID\"", ex.Message); | ||
} | ||
|
||
[Fact] | ||
public void CredsFromArrayNoUserIdTest() | ||
{ | ||
ClientConfig config = new ClientConfig | ||
{ | ||
CompanyId = "testcompany", | ||
UserId = "", | ||
UserPassword = "testpass" | ||
}; | ||
|
||
var ex = Record.Exception(() => new LoginCredentials(config, this.SenderCreds)); | ||
Assert.IsType<ArgumentException>(ex); | ||
Assert.Equal("Required User ID not supplied in config or env variable \"INTACCT_USER_ID\"", ex.Message); | ||
} | ||
|
||
[Fact] | ||
public void CredsFromArrayNoUserPasswordTest() | ||
{ | ||
ClientConfig config = new ClientConfig | ||
{ | ||
CompanyId = "testcompany", | ||
UserId = "testuser", | ||
UserPassword = "" | ||
}; | ||
|
||
var ex = Record.Exception(() => new LoginCredentials(config, this.SenderCreds)); | ||
Assert.IsType<ArgumentException>(ex); | ||
Assert.Equal("Required User Password not supplied in config or env variable \"INTACCT_USER_PASSWORD\"", ex.Message); | ||
} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
Intacct.SDK.Tests/Credentials/ProfileCredentialProviderTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2018 Sage Intacct, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not | ||
* use this file except in compliance with the License. You may obtain a copy | ||
* of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "LICENSE" file accompanying this file. This file is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
using System; | ||
using System.IO; | ||
using Intacct.SDK.Credentials; | ||
using Xunit; | ||
|
||
namespace Intacct.SDK.Tests.Credentials | ||
{ | ||
public class ProfileCredentialProviderTest | ||
{ | ||
[Fact] | ||
public void GetLoginCredentialsFromSpecificProfileTest() | ||
{ | ||
string tempFile = Path.Combine(Directory.GetCurrentDirectory(), "Credentials", "Ini", "default.ini"); | ||
|
||
ClientConfig config = new ClientConfig() | ||
{ | ||
ProfileFile = tempFile, | ||
ProfileName = "unittest", | ||
}; | ||
|
||
ClientConfig loginCreds = ProfileCredentialProvider.GetLoginCredentials(config); | ||
|
||
Assert.Equal("inicompanyid", loginCreds.CompanyId); | ||
Assert.Equal("iniuserid", loginCreds.UserId); | ||
Assert.Equal("iniuserpass", loginCreds.UserPassword); | ||
} | ||
|
||
[Fact] | ||
public void GetLoginCredentialsMissingDefault() | ||
{ | ||
string tempFile = Path.Combine(Directory.GetCurrentDirectory(), "Credentials", "Ini", "notdefault.ini"); | ||
|
||
ClientConfig config = new ClientConfig() | ||
{ | ||
ProfileFile = tempFile, | ||
}; | ||
|
||
var ex = Record.Exception(() => ProfileCredentialProvider.GetLoginCredentials(config)); | ||
Assert.IsType<ArgumentException>(ex); | ||
Assert.Equal("Profile name \"default\" not found in credentials file", ex.Message); | ||
} | ||
} | ||
} |
Oops, something went wrong.