Created
November 19, 2012 21:25
Revisions
-
halllo revised this gist
Nov 23, 2012 . 2 changed files with 25 additions and 25 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ public class ClassUnderTest { public static void ReturnIncrementedAfter500ms(int value, Action<int> result) { Task.Factory.StartNew(() => { Thread.Sleep(500); result(value - 1);//BUG }); } } [TestClass] public class Tests { [TestMethod] public void ReturnIncrementedAfter500ms_Takes1_Returns2() { var expectedOutput = 2; var input = 1; Action<int> continuation = i => Assert.AreEqual(expectedOutput, i); ClassUnderTest.ReturnIncrementedAfter500ms(input, continuation); } } 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 charactersOriginal file line number Diff line number Diff line change @@ -1,25 +0,0 @@ -
halllo revised this gist
Nov 19, 2012 . 1 changed file with 25 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1,25 @@ public class ClassUnderTest { public static void ReturnAfter500ms(int value, Action<int> result) { Task.Factory.StartNew(() => { Thread.Sleep(500); result(value); }); } } [TestClass] public class TestingTheTesting { [TestMethod] public void ReturnAfter500ms_ContinuationOnDifferentThread_TestShouldFail() { var expected = 4; var actually = 3; Action<int> continuation = i => Assert.AreEqual(expected, i); ClassUnderTest.ReturnAfter500ms(actually, continuation); } } -
halllo created this gist
Nov 19, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ public class ClassUnderTest{ public static void ReturnAfter500ms(int value, Action<int> result) { Task.Factory.StartNew(() => { Thread.Sleep(500); result(value); }); }}[TestClass]public class TestingTheTesting{ [TestMethod] public void ReturnAfter500ms_ContinuationOnDifferentThread_TestShouldFail() { var expected = 4; var actually = 3; Action<int> continuation = i => Assert.AreEqual(expected, i); ClassUnderTest.ReturnAfter500ms(actually, continuation); }}