56 lines
1.3 KiB
C#
56 lines
1.3 KiB
C#
#if DEBUG
|
|
using System;
|
|
using System.Text;
|
|
using NUnit.Framework;
|
|
|
|
namespace sscs.cache
|
|
{
|
|
|
|
[TestFixture]
|
|
public class TestSecret
|
|
{
|
|
|
|
[Test]
|
|
public void DefaultAddSecret()
|
|
{
|
|
|
|
string someotherstr = "newvalue";
|
|
byte[] newval = Encoding.ASCII.GetBytes(someotherstr);
|
|
|
|
Secret mysec = new Secret();
|
|
|
|
mysec.SetKey("newkey");
|
|
mysec.SetValue(newval);
|
|
mysec.SetEpasswd("enhanced");
|
|
mysec.SetKey("alternatekey");
|
|
|
|
Assert.AreEqual("newvalue", Encoding.ASCII.GetString(mysec.GetValue("alternatekey")));
|
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
public void TestAddSecret()
|
|
{
|
|
|
|
string somestr = "novell123";
|
|
string someotherstr = "newvalue";
|
|
byte[] mybyte = Encoding.ASCII.GetBytes(somestr);
|
|
byte[] newval = Encoding.ASCII.GetBytes(someotherstr);
|
|
|
|
Secret mysec = new Secret("mail", mybyte);
|
|
mysec.SetKey("newkey");
|
|
mysec.SetValue(newval);
|
|
|
|
Assert.AreEqual("newkey", mysec.GetKey());
|
|
Assert.AreEqual("newvalue", Encoding.ASCII.GetString(mysec.GetValue()));
|
|
|
|
}
|
|
|
|
//TBD: Need to Add Timestamp related cases, could be done when we use it
|
|
|
|
|
|
}
|
|
}
|
|
#endif
|