Created
January 22, 2014 03:47
-
-
Save dck-jp/8553197 to your computer and use it in GitHub Desktop.
Unit test code for PrefetchedProperty.cs by NUnit & ChainingAssertion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [TestFixture] | |
| public class Test1 | |
| { | |
| [Test] | |
| public void TestMethod即座に読み出し() | |
| { | |
| var prefetch = new Class1(); | |
| prefetch.PropertyA.Is("abc"); | |
| } | |
| [Test] | |
| public void Test1秒後に読み出し() | |
| { | |
| var prefetch = new Class1(); | |
| Thread.Sleep(1100); | |
| prefetch.PropertyA.Is("abc"); | |
| } | |
| [Test] | |
| public void Test1秒後に読み出し_さらに読み出し() | |
| { | |
| var prefetch = new Class1(); | |
| Thread.Sleep(1100); | |
| prefetch.PropertyA.Is("abc"); | |
| Thread.Sleep(100); | |
| prefetch.PropertyA.Is("abc"); | |
| } | |
| [Test] | |
| public void Test読み出し速度の確認() | |
| { | |
| var sw = new Stopwatch(); | |
| sw.Start(); | |
| var prefetch = new Class1(); | |
| prefetch.PropertyA.Is("abc"); | |
| sw.Stop(); var t1 = sw.ElapsedMilliseconds; | |
| sw.Restart(); | |
| prefetch.PropertyA.Is("abc"); | |
| sw.Stop(); var t2 = sw.ElapsedMilliseconds; | |
| Assert.Greater(t1, t2); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment