CASA/c_micasad/test/cache/TestSecret.cs
2005-10-11 19:51:00 +00:00

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