namespace CanAppTester
{
using global::Microsoft.VisualStudio.TestTools.UnitTesting;
using global::SharedObjects.Protocol;
///
///This is a test class for ProtocolsTest and is intended
///to contain all ProtocolsTest Unit Tests
///
[TestClass()]
public class ProtocolsTest
{
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 getProtocolById
///
[TestMethod()]
public void getProtocolByIdTest()
{
int id = Protocols.ISO9141;
Protocols actual = Protocols.getProtocolById(id);
Assert.IsTrue(actual != null, "Known protocol was not found.", null);
}
///
///A test for getProtocolById
///
[TestMethod()]
public void getProtocolByIdNegativeTest()
{
int id = 4711; // ID value for non-existing protocol.
Protocols actual = Protocols.getProtocolById(id);
Assert.IsTrue(actual == null, "Unknown protocol was found.", null);
}
///
///A test for getProtocolByName
///
[TestMethod()]
public void getProtocolByNameTest()
{
Protocols actual = Protocols.getProtocolByName("ISO9141");
Assert.IsTrue(actual != null, "Known protocol was not found.", null);
}
///
///A test for getProtocolByName
///
[TestMethod()]
public void getProtocolByNameNegativeTest()
{
Protocols actual = Protocols.getProtocolByName("NOT A PROTOCOL");
Assert.IsTrue(actual == null, "Unknown protocol was found.", null);
}
}
}