forked from Acumatica/AcumaticaRESTAPIClientForCSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dnaumov
committed
Jul 22, 2020
1 parent
69df04f
commit c45a582
Showing
6 changed files
with
143 additions
and
17 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
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,46 @@ | ||
using FluentAssertions; | ||
using System.Linq; | ||
using Xunit; | ||
using System; | ||
using System.Globalization; | ||
|
||
using Acumatica.RESTClient.Model; | ||
using Acumatica.RESTClient.Api; | ||
|
||
namespace RESTClientTests | ||
{ | ||
public class ActionLocationTests | ||
{ | ||
[Theory] | ||
[InlineData("/demo", "Default", "{0}/entity/{1}/18.200.001/Bill/ReleaseBill/status/9bab77d3-61dd-488a-ba84-d6820f06d114")] | ||
[InlineData("", "Default", "{0}/entity/{1}/18.200.001/Bill/ReleaseBill/status/42e1c8e2-6346-452e-a604-cff94e7d751a")] | ||
[InlineData("/demo/test", "Default", "{0}/entity/{1}/18.200.001/Bill/ReleaseBill/status/1c1a0de3-2bc1-41ea-93fd-c4e3d98e7f03")] | ||
[InlineData("/AcumaticaEntity", "CustomEntityEndpoint", "{0}/entity/{1}/18.200.001/Bill/ReleaseBill/status/1c1a0de3-2bc1-41ea-93fd-c4e3d98e7f03")] | ||
[InlineData("http://localhost:1231", "Default", "{0}/entity/{1}/18.200.001/Bill/ReleaseBill/status/1c1a0de3-2bc1-41ea-93fd-c4e3d98e7f03")] | ||
[InlineData("https://int.acumatica.com/TestsSite", "Default", "{0}/entity/{1}/18.200.001/Bill/ReleaseBill/status/1c1a0de3-2bc1-41ea-93fd-c4e3d98e7f03")] | ||
public void ParseLocationTestWithAction(string expectedSite, string expectedEndpoint, string inputLocation) | ||
{ | ||
var parsedLocation = EntityAPI<Entity>.ParseLocation(string.Format(inputLocation, expectedSite, expectedEndpoint)); | ||
parsedLocation.EndpointName.Should().Be(expectedEndpoint); | ||
parsedLocation.EndpointVersion.Should().Be("18.200.001"); | ||
parsedLocation.ActionName.Should().Be("ReleaseBill"); | ||
parsedLocation.Site.Should().Be(expectedSite); | ||
} | ||
|
||
[Theory] | ||
[InlineData("/demo", "Default", "{0}/entity/{1}/18.200.001/Bill/")] | ||
[InlineData("", "Default", "{0}/entity/{1}/18.200.001/Bill")] | ||
[InlineData("/demo/test", "Default", "{0}/entity/{1}/18.200.001/Bill/")] | ||
[InlineData("/AcumaticaEntity", "CustomEntityEndpoint", "{0}/entity/{1}/18.200.001/Bill")] | ||
[InlineData("http://localhost:1231", "Default", "{0}/entity/{1}/18.200.001/Bill")] | ||
[InlineData("https://int.acumatica.com/TestsSite", "Default", "{0}/entity/{1}/18.200.001/Bill")] | ||
public void ParseLocationTestWithoutAction(string expectedSite, string expectedEndpoint, string inputLocation) | ||
{ | ||
var parsedLocation = EntityAPI<Entity>.ParseLocation(string.Format(inputLocation, expectedSite, expectedEndpoint)); | ||
parsedLocation.EndpointName.Should().Be(expectedEndpoint); | ||
parsedLocation.EndpointVersion.Should().Be("18.200.001"); | ||
parsedLocation.ActionName.Should().BeNull(); | ||
parsedLocation.Site.Should().Be(expectedSite); | ||
} | ||
} | ||
} |
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,44 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net48</TargetFramework> | ||
<AssemblyTitle>RESTClientTests</AssemblyTitle> | ||
<Product>RESTClientTests</Product> | ||
<Copyright>Copyright © 2020</Copyright> | ||
<OutDir>bin\$(Configuration)\</OutDir> | ||
<WarningLevel>3</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugType>full</DebugType> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Remove="Properties\**" /> | ||
<EmbeddedResource Remove="Properties\**" /> | ||
<None Remove="Properties\**" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="FluentAssertions" Version="5.10.3" /> | ||
<PackageReference Include="System.ValueTuple" Version="4.4.0" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.abstractions" Version="2.0.3" /> | ||
<PackageReference Include="xunit.analyzers" Version="0.10.0" /> | ||
<PackageReference Include="xunit.assert" Version="2.4.1" /> | ||
<PackageReference Include="xunit.core" Version="2.4.1" /> | ||
<PackageReference Include="xunit.extensibility.core" Version="2.4.1" /> | ||
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Reference Include="System.ServiceModel" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Net.Http" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Acumatica.RESTClient\Acumatica.RESTClient.csproj" /> | ||
</ItemGroup> | ||
</Project> |
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,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<runtime> | ||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<dependentAssembly> | ||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> | ||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" /> | ||
</dependentAssembly> | ||
</assemblyBinding> | ||
</runtime> | ||
</configuration> |
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,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="FluentAssertions" version="5.10.3" targetFramework="net48" /> | ||
<package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net48" /> | ||
<package id="MSTest.TestFramework" version="1.3.2" targetFramework="net48" /> | ||
<package id="xunit.abstractions" version="2.0.3" targetFramework="net48" /> | ||
<package id="xunit.extensibility.core" version="2.4.1" targetFramework="net48" /> | ||
<package id="xunit.runner.console" version="2.4.1" targetFramework="net48" developmentDependency="true" /> | ||
<package id="xunit.runner.visualstudio" version="2.4.1" targetFramework="net48" developmentDependency="true" /> | ||
</packages> |