62 lines
1.9 KiB
C#
62 lines
1.9 KiB
C#
using System;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using SipComponent;
|
|
using System.Diagnostics;
|
|
|
|
namespace UnitTestProject
|
|
{
|
|
[TestClass]
|
|
public class UnitTest1
|
|
{
|
|
static bool _delivered = false;
|
|
const string _sipIDdestination = "7002120";
|
|
const string _msgText = "Gigd";
|
|
static string _sipMsgBody;
|
|
|
|
static UnitTest1()
|
|
{
|
|
string deliveredInfo = _delivered ? "been delivered" : "failed";
|
|
_sipMsgBody = "Your message - " + _msgText + " - to " + _sipIDdestination + " has " + deliveredInfo;
|
|
}
|
|
|
|
|
|
/*
|
|
[TestMethod]
|
|
public void TestMethodGetTextFromConfirmation()
|
|
{
|
|
string text = SipClientClass.GetTextFromConfirmation(_sipMsgBody);
|
|
Assert.AreEqual(_msgText, text);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodGetIDfromConfirmation()
|
|
{
|
|
string sipDestination = SipClientClass.GetDestinationIDFromConfirmation(_sipMsgBody);
|
|
Assert.AreEqual(_sipIDdestination, sipDestination);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodGetDeliveredStatusFromConfirmation()
|
|
{
|
|
bool received = SipClientClass.GetDeliveredStatusFromConfirmation(_sipMsgBody);
|
|
Assert.AreEqual(_delivered, received);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestMethodGetSmsKeyFromConfirmation()
|
|
{
|
|
string smsKey = SipClientClass.GetSmsKeyFromConfirmation(_sipMsgBody);
|
|
string expectedValue = _sipIDdestination + _msgText.GetHashCode();
|
|
System.Diagnostics.Trace.WriteLine(expectedValue);
|
|
Assert.AreEqual(expectedValue, smsKey);
|
|
}
|
|
* */
|
|
|
|
[TestMethod]
|
|
public void TestSipMessageGenerator()
|
|
{
|
|
Trace.WriteLine(SipClientClass.GenerateSipMessage("33", "6004", "10.120.1.138", 5060, "Hello", true));
|
|
}
|
|
}
|
|
}
|