uhnit testing from vscode
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace isn.tests
|
||||
@ -20,20 +22,7 @@ namespace isn.tests
|
||||
}
|
||||
|
||||
[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()
|
||||
public void HAveADefaultDataProtector()
|
||||
{
|
||||
string pass = "a lame and big pass";
|
||||
isn.IDataProtector _protector = new isn.DefaultDataProtector();
|
||||
@ -41,8 +30,10 @@ namespace isn.tests
|
||||
string unprotectedpass = _protector.UnProtect(protectedpass);
|
||||
Console.WriteLine(protectedpass);
|
||||
Assert.AreEqual(pass, unprotectedpass);
|
||||
Assert.Pass();
|
||||
Assert.Pass($"Good jod man! (decoding {protectedpass})");
|
||||
}
|
||||
|
||||
// Not a [Test]
|
||||
public void TestParseCplus()
|
||||
{
|
||||
INeedEngine engine = new Engine();
|
||||
@ -50,12 +41,14 @@ namespace isn.tests
|
||||
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();
|
||||
@ -63,6 +56,19 @@ namespace isn.tests
|
||||
IRing zero = Ring.Zero;
|
||||
Assert.True(c.Add(zero).Equals(c));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AssertReadInput()
|
||||
{
|
||||
var oldOut = Console.Out;
|
||||
StringBuilder censoredTxt = new StringBuilder();
|
||||
var newOut = new StringWriter(censoredTxt);
|
||||
Console.SetOut(newOut);
|
||||
Console.WriteLine("~~censored~~");
|
||||
Console.SetOut(oldOut);
|
||||
Console.Write("Hello ");
|
||||
Console.Write(censoredTxt);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user