68 lines
1.8 KiB
C#
68 lines
1.8 KiB
C#
using System;
|
|
using NUnit.Framework;
|
|
|
|
namespace isn.tests
|
|
{
|
|
public class Tests
|
|
{
|
|
private const int V = 0;
|
|
private const int V1 = 1;
|
|
|
|
public interface INeedEngine
|
|
{
|
|
object Parse(string code);
|
|
|
|
}
|
|
|
|
[SetUp]
|
|
public void Setup()
|
|
{
|
|
}
|
|
|
|
[Test]
|
|
public void Test1()
|
|
{
|
|
string pass = "a";
|
|
isn.IDataProtector _protector = new isn.DefaultDataProtector();
|
|
string protectedpass = _protector.Protect(pass);
|
|
string unprotectedpass = _protector.UnProtect(protectedpass);
|
|
Console.WriteLine(protectedpass);
|
|
Assert.AreEqual(pass, unprotectedpass);
|
|
Assert.Pass();
|
|
}
|
|
|
|
|
|
[Test]
|
|
public void Test26()
|
|
{
|
|
string pass = "a lame and big pass";
|
|
isn.IDataProtector _protector = new isn.DefaultDataProtector();
|
|
string protectedpass = _protector.Protect(pass);
|
|
string unprotectedpass = _protector.UnProtect(protectedpass);
|
|
Console.WriteLine(protectedpass);
|
|
Assert.AreEqual(pass, unprotectedpass);
|
|
Assert.Pass();
|
|
}
|
|
public void TestParseCplus()
|
|
{
|
|
INeedEngine engine = new Engine();
|
|
IRing c = new Ring();
|
|
Assert.Equals((INeedEngine)engine.Parse("c+"), c.Add(Ring.One));
|
|
}
|
|
|
|
public void AssertIRingIsABody()
|
|
{
|
|
Ring c = new Ring();
|
|
Ring one = Ring.One;
|
|
Assert.True(c.Mult(one).Equals(c));
|
|
}
|
|
public void AssertIRingIsARing()
|
|
{
|
|
AssertIRingIsABody();
|
|
Ring c = new Ring();
|
|
IRing zero = Ring.Zero;
|
|
Assert.True(c.Add(zero).Equals(c));
|
|
}
|
|
|
|
}
|
|
} |