TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ana Ana
NA
11
11.2k
Error message in unit testing
Mar 3 2011 4:21 AM
I try to write an unit tests. Now, I compare two values - actual and expected.
Actual value is a string and expected is a intiger, that will represent the length of actual string.
I used the Assert.AreEqual function to compare these values, but I get an error message:
Error Message:
Test method UnitBL0001.CommonTest.DecodeTest threw exception:
System.FormatException: Invalid length for a Base-64 char array.
Error Stack Trace:
System.Convert.FromBase64String(String s).
How can I comapre these values in some other way? Is my way to create unit tests is correct?
Source:
[TestMethod()]
public void DecodeTest()
{
string strCryptoPassword = "123pass"; // TODO: Initialize to an appropriate value
int expected = 0; // TODO: Initialize to an appropriate value
string actual;
actual = Common.Decode(strCryptoPassword);
expected = actual.Length;
Assert.AreEqual(expected, actual.Length);
}
Attachment:
source.zip
Reply
Answers (
2
)
creatiind dynamic controls
Unit test for insert method