|
using LinqTest;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace TestProject1
{
/// <summary>
///This is a test class for ProgramTest and is intended
///to contain all ProgramTest Unit Tests
///</summary>
[TestClass()]
public class ProgramTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
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
/// <summary>
///A test for FillArray
///</summary>
[TestMethod()]
[DeploymentItem("LinqTest.exe")]
public void FillArrayTest()
{
int n = 10; // TODO: Initialize to an appropriate value
Program_Accessor.FillArray(n);
Assert.AreEqual(n, Program_Accessor.theArray.Length);
}
/// <summary>
///A test for GetOdd
///</summary>
[TestMethod()]
[DeploymentItem("LinqTest.exe")]
public void GetOddTest()
{
int expected = 1; // In every 2 numbers, one is odd
int actual;
Program_Accessor.FillArray(2);
actual = Program_Accessor.GetOdd();
Assert.AreEqual(expected, actual);
}
/// <summary>
///A test for GetOddForEach
///</summary>
[TestMethod()]
[DeploymentItem("LinqTest.exe")]
public void GetOddForEachTest()
{
int expected = 1; // In every 2 numbers, one is odd
int actual;
Program_Accessor.FillArray(2);
actual = Program_Accessor.GetOddForEach();
Assert.AreEqual(expected, actual);
}
/// <summary>
///A test for GetOddLinq
///</summary>
[TestMethod()]
[DeploymentItem("LinqTest.exe")]
public void GetOddLinqTest()
{
int expected = 1; // In every 2 numbers, one is odd
int actual;
Program_Accessor.FillArray(2);
actual = Program_Accessor.GetOddLinq();
Assert.AreEqual(expected, actual);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Currently, I manage the West Coast Professional Services team for a large company. Part of my job includes implementing solutions and developing "glue" applications.
I love RAD (Rapid Application Development) - specify a problem, come up with the solution, code it - and change later. This is where coding comes closest to art. Just let it flow...
If you want more biographical items, look at my LinkedIn profile at
http://www.linkedin.com/in/gvider and if you'd like to see my opinion on other tech-related subjects, read my blog at
http://www.guyvider.com.