using SharedObjects.Protocol;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace CanAppTester
{
///
///This is a test class for TxMsgTest and is intended
///to contain all TxMsgTest Unit Tests
///
[TestClass()]
public class TxMsgTest
{
private TestContext testContextInstance;
///
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
///
///A test for TxMsg Constructor
///
[TestMethod()]
public void TxMsgConstructorTest()
{
byte[] payload = null;
bool success = false;
try
{
TxMsg target = new TxMsg(payload);
success = (target != null);
}
finally
{
Assert.IsTrue(success, "Constructor for TxMsg failed.", null);
}
}
///
///A test for Equals
///
[TestMethod()]
public void EqualsTest()
{
TxMsg target = new TxMsg(TxMsg.GET_DTCS);
object obj = new TxMsg(TxMsg.GET_DTCS);
bool actual;
actual = target.Equals(obj);
Assert.IsTrue(actual, "Equal objects considered different", null);
}
///
///A test for Equals
///
[TestMethod()]
public void NotEqualsTest()
{
TxMsg target = new TxMsg(TxMsg.GET_DTCS);
object obj = new TxMsg(TxMsg.CLEAR_DTCS);
bool actual;
actual = target.Equals(obj);
Assert.IsFalse(actual, "Different objects considered equals", null);
}
///
///A test for GetHashCode
///
[TestMethod()]
public void GetHashCodeTest()
{
TxMsg target = new TxMsg(TxMsg.GET_DTCS);
int actual = target.GetHashCode();
Assert.IsTrue(actual != 0, "GetHashCode was invalid.", null);
}
///
///A test for ToString
///
[TestMethod()]
public void ToStringTest()
{
TxMsg target = new TxMsg(TxMsg.GET_DTCS);
string actual = target.ToString();
Assert.IsTrue(actual.Length > 0, "ToString was empty.", null);
}
}
}