CASA/c_micasad/test/cache/TestSecret.cs
2006-02-01 17:48:29 +00:00

78 lines
2.2 KiB
C#

/***********************************************************************
*
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, Novell, Inc.
*
* To contact Novell about this file by physical or electronic mail,
* you may find current contact information at www.novell.com.
*
***********************************************************************/
#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