Add unit tests! woo!
This commit is contained in:
1 parent
7c2960e1d7
commit
a3f60cfd25
4 files changed
+116
-19
No files matched your search
@@ -0,0 +1,104 @@
|
||||
using System.Reflection;
|
||||
using FrappeMocha.Keygen;
|
||||
using FrappeMocha.Keygen.Platforms;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace PlatformUnitTests
|
||||
{
|
||||
[TestClass]
|
||||
public class PlatformUnitTest
|
||||
{
|
||||
private KeygenBase platform;
|
||||
private readonly string[] _testCompanyUserStrings = {"Test", "FrappeMocha", "abcd", "1234"};
|
||||
|
||||
[TestMethod]
|
||||
public void TestWindowsPlatform()
|
||||
{
|
||||
platform = new PlatformWindows();
|
||||
foreach (var product in platform.Products)
|
||||
{
|
||||
var types = platform.GenerateLicencetypes(product);
|
||||
for (int i = 0; i < types.Count; i++)
|
||||
{
|
||||
foreach (string company in _testCompanyUserStrings)
|
||||
{
|
||||
var key = platform.Generate(i, company, product.Licence);
|
||||
Assert.IsTrue(platform.Check(key, company, product.Licence));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestMacOsxPlatform()
|
||||
{
|
||||
platform = new PlatformMac();
|
||||
foreach (var product in platform.Products)
|
||||
{
|
||||
var types = platform.GenerateLicencetypes(product);
|
||||
for (int i = 0; i < types.Count; i++)
|
||||
{
|
||||
foreach (string company in _testCompanyUserStrings)
|
||||
{
|
||||
var key = platform.Generate(i, company, product.Licence);
|
||||
Assert.IsTrue(platform.Check(key, company, product.Licence));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestAndroidPlatform()
|
||||
{
|
||||
platform = new PlatformAndroid();
|
||||
foreach (var product in platform.Products)
|
||||
{
|
||||
var types = platform.GenerateLicencetypes(product);
|
||||
for (int i = 0; i < types.Count; i++)
|
||||
{
|
||||
foreach (string company in _testCompanyUserStrings)
|
||||
{
|
||||
var key = platform.Generate(i, company, product.Licence);
|
||||
Assert.IsTrue(platform.Check(key, company, product.Licence));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestJavaPlatform()
|
||||
{
|
||||
platform = new PlatformJava();
|
||||
foreach (var product in platform.Products)
|
||||
{
|
||||
var types = platform.GenerateLicencetypes(product);
|
||||
for (int i = 0; i < types.Count; i++)
|
||||
{
|
||||
foreach (string company in _testCompanyUserStrings)
|
||||
{
|
||||
var key = platform.Generate(i, company, product.Licence);
|
||||
Assert.IsTrue(platform.Check(key, company, product.Licence));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestJavaScriptPlatform()
|
||||
{
|
||||
platform = new PlatformJavaScript();
|
||||
foreach (var product in platform.Products)
|
||||
{
|
||||
var types = platform.GenerateLicencetypes(product);
|
||||
for (int i = 0; i < types.Count; i++)
|
||||
{
|
||||
foreach (string company in _testCompanyUserStrings)
|
||||
{
|
||||
var key = platform.Generate(i, company, product.Licence);
|
||||
Assert.IsTrue(platform.Check(key, company, product.Licence));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user