Skip to content

Commit

Permalink
Add & fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Noisyfox committed Oct 5, 2017
1 parent bc9a6f3 commit 3a1eb1f
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<Reference Include="System.Net.Http.WebRequest" />
</ItemGroup>
<ItemGroup>
<Compile Include="YandaxTranslateTest.cs" />
<Compile Include="WorldNameTest.cs" />
<Compile Include="YoudaoTranslateTest.cs" />
<Compile Include="BaiduTranslateTest.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ public void TestBaiduTranslate()
new ChattingLine{RawContent = "This is a string &lt; contains html tag."},
new ChattingLine{RawContent = "&lt;"},
new ChattingLine{RawContent = "你在逗我呢?"},
}.ToList();
}.Select(it =>
{
provider.PreprocessLine(it);
return it;
}).ToList();

provider.Translate(lines);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ public void TestBingTranslate()
new ChattingLine{RawContent = "This is a string <aaa> contains html tag."},
new ChattingLine{RawContent = "This is a string &lt; contains html tag."},
new ChattingLine{RawContent = "&lt;"},
}.ToList();
}.Select(it =>
{
provider.PreprocessLine(it);
return it;
}).ToList();

provider.Translate(lines);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ public void TestUnofficialGoogleTranslate()
new ChattingLine{RawContent = "This is a string &lt; contains html tag."},
new ChattingLine{RawContent = "&lt;"},
new ChattingLine{RawContent = "你在逗我呢?"},
}.ToList();
}.Select(it =>
{
provider.PreprocessLine(it);
return it;
}).ToList();

provider.Translate(lines);
}
Expand Down
38 changes: 38 additions & 0 deletions ACT.FFXIVTranslate/ACT.FFXIVTranslate.Test/YandaxTranslateTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using System.Linq;
using ACT.FFXIVTranslate.localization;
using ACT.FFXIVTranslate.translate.yandax;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace ACT.FFXIVTranslate.Test
{
[TestClass]
public class YandaxTranslateTest
{
[TestMethod]
public void TestYandaxTranslate()
{
var factory = new YandaxTranslateProviderFactory();
var key = factory.DefaultPublicKey;
var to = LanguageDef.BuildLangFromCulture("zh");
var provider = factory.CreateProvider(key, null, to);

var lines = new[]
{
new ChattingLine {RawContent = "This is a testing string."},
new ChattingLine {RawContent = "This is another testing string."},
new ChattingLine {RawContent = "Wow lots of strings!"},
new ChattingLine {RawContent = "I like the game called 'Final Fantasy XIV'!"},
new ChattingLine {RawContent = "This is a string <aaa> contains html tag."},
new ChattingLine {RawContent = "This is a string &lt; contains html tag."},
new ChattingLine {RawContent = "&lt;"},
}.Select(it =>
{
provider.PreprocessLine(it);
return it;
}).ToList();

provider.Translate(lines);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ public void TestYoudaoTranslate()
new ChattingLine{RawContent = "This is a string &lt; contains html tag."},
new ChattingLine{RawContent = "&lt;"},
new ChattingLine{RawContent = "你在逗我呢?"},
}.ToList();
}.Select(it =>
{
provider.PreprocessLine(it);
return it;
}).ToList();

provider.Translate(lines);
}
Expand Down

0 comments on commit 3a1eb1f

Please sign in to comment.