- Main Page
- Classes
- Files

- File List

# C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/Tests/UnitTestHighResolutionTimer.cs

    00001 ﻿namespace Tests
    00002 {
    00003     using System;
    00004     using System.Text;
    00005     using System.Threading;
    00006     using Microsoft.VisualStudio.TestTools.UnitTesting;
    00007     using NewGamePhysics.Utilities;
    00008
    00012     [TestClass]
    00013     public class UnitTestHighResolutionTimer
    00014     {
    00015         public UnitTestHighResolutionTimer()
    00016         {
    00017         }
    00018
    00019         private TestContext testContextInstance;
    00020
    00025         public TestContext TestContext
    00026         {
    00027             get
    00028             {
    00029                 return testContextInstance;
    00030             }
    00031             set
    00032             {
    00033                 testContextInstance = value;
    00034             }
    00035         }
    00036
    00037         [TestMethod]
    00038         public void GetCounter()
    00039         {
    00040             long value1 = HighResolutionTimer.Counter();
    00041             System.Console.WriteLine("Counter = " + value1);
    00042             System.Threading.Thread.Sleep(1);
    00043             long value2 = HighResolutionTimer.Counter();
    00044             System.Console.WriteLine("Counter = " + value2 + " (again)");
    00045             Assert.AreNotEqual(value1, value2, "Counter should be changing");
    00046             System.Console.WriteLine("Difference: " + (value2 - value1));
    00047         }
    00048
    00049         [TestMethod]
    00050         public void GetFrequency()
    00051         {
    00052             long value1 = HighResolutionTimer.Frequency();
    00053             System.Console.WriteLine("Frequency = " + value1);
    00054             System.Threading.Thread.Sleep(1);
    00055             long value2 = HighResolutionTimer.Frequency();
    00056             System.Console.WriteLine("Frequency = " + value2 + " (again)");
    00057             Assert.AreEqual(value1, value2, "Frequency should not change");
    00058         }
    00059
    00060         [TestMethod]
    00061         public void GetSeconds()
    00062         {
    00063             double value1 = HighResolutionTimer.Seconds();
    00064             System.Console.WriteLine("Seconds = " + value1);
    00065             System.Threading.Thread.Sleep(1);
    00066             double value2 = HighResolutionTimer.Seconds();
    00067             System.Console.WriteLine("Seconds = " + value2 + " (again)");
    00068             Assert.AreNotEqual(value1, value2, "Seconds should be changing");
    00069             System.Console.WriteLine("Difference: " + (value2 - value1));
    00070         }
    00071     }
    00072 }