Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 23 additions & 22 deletions server/src/en/UnitTestEnPlugin/TestEnglish.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
using System.Net;
using System.Net.Http;

namespace UnitTestEnPlugin
{
Expand Down Expand Up @@ -57,9 +58,9 @@ public TestContext TestContext
public void SanitizeBasicNoSanitize()
{
string translation;
using (WebClient wc = new())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language elp = new Language (translation);
string testWordInput = "this is a test";
Expand All @@ -83,9 +84,9 @@ public void SanitizeWithDiacritics()
public void SanitizeBasicRemoveCurlyBraces()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language elp = new Language(translation);
string testWordInput = "this is{a}test";
Expand All @@ -97,9 +98,9 @@ public void SanitizeBasicRemoveCurlyBraces()
public void SanitizeBasicRemoveHtmlStuff()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language elp = new Language(translation);
string testWordInput = "this is<a>test";
Expand All @@ -111,9 +112,9 @@ public void SanitizeBasicRemoveHtmlStuff()
public void SingularizeBasic()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language elp = new Language(translation);
string testWordInput = "dogs";
Expand All @@ -125,9 +126,9 @@ public void SingularizeBasic()
public void SingularizeLessBasic()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language elp = new Language(translation);
string testWordInput = "children";
Expand All @@ -139,9 +140,9 @@ public void SingularizeLessBasic()
public void SingularizeNotFound()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language elp = new Language(translation);
string testWordInput = "xxxx";
Expand All @@ -153,9 +154,9 @@ public void SingularizeNotFound()
public void GetLabelsBasic()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language elp = new Language(translation);
var result = elp.GetLabelValues();
Expand All @@ -166,9 +167,9 @@ public void GetLabelsBasic()
public void SynonymBasic()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language elp = new Language(translation);
var result = elp.GetSynonyms ("car");
Expand All @@ -179,9 +180,9 @@ public void SynonymBasic()
public void SynonymNotFound()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language elp = new Language(translation);
var result = elp.GetSynonyms("carxxx");
Expand All @@ -192,9 +193,9 @@ public void SynonymNotFound()
public void ExcludedTerms()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language elp = new Language(translation);
var result = elp.GetExcludedTerms();
Expand All @@ -206,9 +207,9 @@ public void ExcludedTerms()
public void DoNotAmend()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language elp = new Language(translation);
var result = elp.GetDoNotAmend();
Expand Down
57 changes: 29 additions & 28 deletions server/src/ga/TestGaPlugin/TestGa.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using PxLanguagePlugin.ga;
using System.Net;
using System.Net.Http;

namespace TestGaPlugin
{
Expand Down Expand Up @@ -31,9 +32,9 @@ public TestGa() { }
public void TestGetLabelValuesBasic()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language elp = new Language(translation);
Language glp = new Language(translation);
Expand All @@ -46,9 +47,9 @@ public void TestGetLabelValuesBasic()
public void SanitizeBasicNoSanitize()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language glp = new Language(translation);
string testWordInput = "Is teist é seo";
Expand All @@ -60,9 +61,9 @@ public void SanitizeBasicNoSanitize()
public void SanitizeBasicRemoveCurlyBraces()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language glp = new Language(translation);
string testWordInput = "Is teist {é} seo";
Expand All @@ -74,9 +75,9 @@ public void SanitizeBasicRemoveCurlyBraces()
public void SanitizeBasicRemoveHtmlStuff()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language glp = new Language();
string testWordInput = "Is teist <é> seo";
Expand All @@ -88,9 +89,9 @@ public void SanitizeBasicRemoveHtmlStuff()
public void SingularizeBasic()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language glp = new Language(translation);
string testWordInput = "tithe";
Expand All @@ -102,9 +103,9 @@ public void SingularizeBasic()
public void SingularizeLenition()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language glp = new Language(translation);
string testWordInput = "dteach";
Expand All @@ -116,9 +117,9 @@ public void SingularizeLenition()
public void SingularizeAspiration()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language glp = new Language(translation);
string testWordInput = "theach";
Expand All @@ -130,9 +131,9 @@ public void SingularizeAspiration()
public void SingularizeIrregular()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language glp = new Language(translation);
string testWordInput = "mná";
Expand All @@ -144,9 +145,9 @@ public void SingularizeIrregular()
public void SingularizeNotFound()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language glp = new Language(translation);
string testWordInput = "xxxx";
Expand All @@ -158,9 +159,9 @@ public void SingularizeNotFound()
public void GetLabelsBasic()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language glp = new Language(translation);
var result = glp.GetLabelValues();
Expand All @@ -171,9 +172,9 @@ public void GetLabelsBasic()
public void SynonymBasic()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language glp = new Language(translation);
var result = glp.GetSynonyms("sochaí");
Expand All @@ -184,9 +185,9 @@ public void SynonymBasic()
public void SynonymNotFound()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language glp = new Language(translation);
var result = glp.GetSynonyms("xxxxx");
Expand All @@ -197,9 +198,9 @@ public void SynonymNotFound()
public void ExcludedTerms()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language glp = new Language(translation);
var result = glp.GetExcludedTerms();
Expand All @@ -210,9 +211,9 @@ public void ExcludedTerms()
public void DoNotAmend()
{
string translation;
using (WebClient wc = new WebClient())
using (HttpClient client = new HttpClient())
{
translation = wc.DownloadString("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json");
translation = client.GetStringAsync("https://cdn.jsdelivr.net/gh/CSOIreland/PxLanguagePlugins@2.2.0/server/src/en/PxLanguagePlugin/Resources/language.json").Result;
}
Language glp = new Language(translation);
var result = glp.GetDoNotAmend();
Expand Down