|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Silverlight_LOB_Demo_Application.FeedbackControl;
namespace Tests.Unit.Silverlight
{
/// <summary>
/// Summary description for UnitTest1
/// </summary>
[TestClass]
public class UnitTest1
{
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
[TestMethod]
public void TestMethod1()
{
ConvertAndAssert(1120.ConvertToNiceTime(), "1 sec.");
}
[TestMethod]
public void TestMethod2()
{
ConvertAndAssert(3600000.ConvertToNiceTime(), "60 min. 0 sec.");
}
[TestMethod]
public void TestMethod3()
{
ConvertAndAssert(1456120.ConvertToNiceTime(), "24 min. 16 sec.");
}
[TestMethod]
public void TestMethod4()
{
ConvertAndAssert(3700000.ConvertToNiceTime(), "1 h. 1 min. 40 sec.");
}
[TestMethod]
public void TestMethod5()
{
ConvertAndAssert(153700000.ConvertToNiceTime(), "1 d. 18 h. 41 min. 40 sec.");
}
private static void ConvertAndAssert(string convertToNiceTime, string expected)
{
string result = convertToNiceTime;
Assert.AreEqual(expected, result);
}
}
}
|
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.
Peter -hates- dislikes crap software and tries his best to improve the profession of software development. For this reason he joined scrum.org. The seek for improvement keeps him getting out of bed ever day... and the smell of coffee.
One day, Peter woke up and realized that software development is not only about code, but also about people: From his team mates till the end user. Some people you just give donuts and some you need to give a little bit more. Peter is on a journey to make everyone happy.
If he is not sitting on a mountainbike or playing the trumpet, you might find him at a local user group to hang out with other geeks!
----------------
Peter was born in South Tirol (Italy), studied in Austria, enjoyed a beautiful 3 years working in Sydney Australia as a .NET developer for SSW and is now working for Zuehlke Engineering AG.
I blog about .NET development, mostly about development: including C# programming, usability, performance, tips & tricks, best practices, coding problems, and solution development.