Created
April 23, 2011 12:58
-
-
Save johnnonolan/938584 to your computer and use it in GitHub Desktop.
Testing Abstract Class with a mock
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
| public class TestingAnAbstractClassWithAMock | |
| { | |
| [Fact] | |
| public void Should_return_correct_message() | |
| { | |
| var mock = new Mock<MyAbstractClass>(); | |
| var result = mock.Object.MyMethodOnAbstractClass("fish"); | |
| Assert.Equal("I like fish in an abstract sense.", result); | |
| } | |
| } | |
| public class MyAbstractClass | |
| { | |
| public string MyMethodOnAbstractClass(string input) | |
| { | |
| return "I like " + input + " in an abstract sense."; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment