Skip to content

Commit

Permalink
Add more test case and update readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
caroline-ttd committed Apr 30, 2024
1 parent 46eac0c commit 63788fc
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dotnet test
To run the sample app:

```
dotnet run --project src/SampleApp/SampleApp.csproj https://integ.uidapi.com \
dotnet run --project src/SampleApp/SampleApp.csproj https://operator-integ.uidapi.com \
<your-api-token> <your-secret-key> <advertising-token>
```

Expand Down
6 changes: 6 additions & 0 deletions test/UID2.Client.Test/BidstreamClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,15 @@ private void UserOptedOutTest(TokenVersion tokenVersion)
[InlineData("example.com", TokenVersion.V2)]
[InlineData("example.org", TokenVersion.V2)]
[InlineData("com.123.Game.App.android", TokenVersion.V2)]
[InlineData("123456789", TokenVersion.V2)]
[InlineData("example.com", TokenVersion.V3)]
[InlineData("example.org", TokenVersion.V3)]
[InlineData("com.123.Game.App.android", TokenVersion.V3)]
[InlineData("123456789", TokenVersion.V3)]
[InlineData("example.com", TokenVersion.V4)]
[InlineData("example.org", TokenVersion.V4)]
[InlineData("com.123.Game.App.android", TokenVersion.V4)]
[InlineData("123456789", TokenVersion.V4)]
private void TokenIsCstgDerivedTest(string domainOrAppName, TokenVersion tokenVersion)
{
Refresh(KeySharingResponse(new[] { MASTER_KEY, SITE_KEY }));
Expand Down Expand Up @@ -357,18 +360,21 @@ private void DomainOrAppNameCaseSensitiveAndCheckFailedTest(string domainOrAppNa
[InlineData("example.net", TokenVersion.V2)] // Domain associated with site SITE_ID2, as defined by KeySharingResponse().
[InlineData("example.edu", TokenVersion.V2)] // Domain associated with site SITE_ID2, as defined by KeySharingResponse().
[InlineData("com.123.Game.App.ios", TokenVersion.V2)] // App associated with site SITE_ID2, as defined by KeySharingResponse().
[InlineData("123456780", TokenVersion.V2)] // App associated with site SITE_ID2, as defined by KeySharingResponse().
[InlineData("foo.com", TokenVersion.V2)] // Domain not associated with any site.
[InlineData((string)null, TokenVersion.V3)]
[InlineData("", TokenVersion.V3)]
[InlineData("example.net", TokenVersion.V3)] // Domain associated with site SITE_ID2, as defined by KeySharingResponse().
[InlineData("example.edu", TokenVersion.V3)] // Domain associated with site SITE_ID2, as defined by KeySharingResponse().
[InlineData("com.123.Game.App.ios", TokenVersion.V3)] // App associated with site SITE_ID2, as defined by KeySharingResponse().
[InlineData("123456780", TokenVersion.V3)] // App associated with site SITE_ID2, as defined by KeySharingResponse().
[InlineData("foo.com", TokenVersion.V3)] // Domain not associated with any site.
[InlineData((string)null, TokenVersion.V4)]
[InlineData("", TokenVersion.V4)]
[InlineData("example.net", TokenVersion.V4)] // Domain associated with site SITE_ID2, as defined by KeySharingResponse().
[InlineData("example.edu", TokenVersion.V4)] // Domain associated with site SITE_ID2, as defined by KeySharingResponse().
[InlineData("com.123.Game.App.ios", TokenVersion.V4)] // App associated with site SITE_ID2, as defined by KeySharingResponse().
[InlineData("123456780", TokenVersion.V4)] // App associated with site SITE_ID2, as defined by KeySharingResponse().
[InlineData("foo.com", TokenVersion.V4)] // Domain not associated with any site.
private void TokenIsCstgDerivedDomainOrAppNameFailTest(string domainOrAppName, TokenVersion tokenVersion)
{
Expand Down
2 changes: 2 additions & 0 deletions test/UID2.Client.Test/EncryptionTestsV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void UserOptedOutTest()
[InlineData("example.com")]
[InlineData("example.org")]
[InlineData("com.123.Game.App.android")]
[InlineData("123456789")]
public void TokenIsCstgDerivedTest(string domainOrAppName)
{
_client.RefreshJson(KeySharingResponse(new [] { MASTER_KEY, SITE_KEY }));
Expand Down Expand Up @@ -78,6 +79,7 @@ public void DomainOrAppNameCaseSensitiveAndCheckFailedTest(string domainOrAppNam
[InlineData("example.net")]
[InlineData("example.edu")]
[InlineData("com.123.Game.App.ios")]
[InlineData("123456780")]
// Domain not associated with any site.
[InlineData("foo.com")]
public void TokenIsCstgDerivedDomainOrAppNameFailTest(string domainOrAppName)
Expand Down
2 changes: 2 additions & 0 deletions test/UID2.Client.Test/EncryptionTestsV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public void UserOptedOutTest()
[InlineData("example.com")]
[InlineData("example.org")]
[InlineData("com.123.Game.App.android")]
[InlineData("123456789")]
public void TokenIsCstgDerivedTest(string domainOrAppName)
{
_client.RefreshJson(KeySharingResponse(new [] { MASTER_KEY, SITE_KEY }));
Expand Down Expand Up @@ -98,6 +99,7 @@ public void DomainOrAppNameCaseSensitiveAndCheckFailedTest(string domainOrAppNam
[InlineData("example.net")]
[InlineData("example.edu")]
[InlineData("com.123.Game.App.ios")]
[InlineData("123456780")]
// Domain not associated with any site.
[InlineData("foo.com")]
public void TokenIsCstgDerivedDomainOrAppNameFailTest(string domainOrAppName)
Expand Down
2 changes: 2 additions & 0 deletions test/UID2.Client.Test/EncryptionTestsV4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ public void UserOptedOutTest()
[InlineData("example.com")]
[InlineData("example.org")]
[InlineData("com.123.Game.App.android")]
[InlineData("123456789")]
public void TokenIsCstgDerivedTest(string domainOrAppName)
{
_client.RefreshJson(KeySharingResponse(new [] { MASTER_KEY, SITE_KEY }));
Expand Down Expand Up @@ -230,6 +231,7 @@ public void DomainOrAppNameCaseSensitiveAndCheckFailedTest(string domainOrAppNam
[InlineData("example.net")]
[InlineData("example.edu")]
[InlineData("com.123.Game.App.ios")]
[InlineData("123456780")]
// Domain not associated with any site.
[InlineData("foo.com")]
public void TokenIsCstgDerivedDomainOrAppNameFailTest(string domainOrAppName)
Expand Down
4 changes: 2 additions & 2 deletions test/UID2.Client.Test/TestData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ internal static string KeySharingResponse(IEnumerable<Key> keys, int? callerSite
new
{
id = SITE_ID,
domain_names = new[] { "example.com", "example.org", "com.123.Game.App.android" }
domain_names = new[] { "example.com", "example.org", "com.123.Game.App.android", "123456789" }
},
new
{
id = SITE_ID2,
domain_names = new[] { "example.net", "example.edu", "com.123.Game.App.ios" }
domain_names = new[] { "example.net", "example.edu", "com.123.Game.App.ios", "123456780" }
}
}
}
Expand Down

0 comments on commit 63788fc

Please sign in to comment.