Created
July 9, 2017 03:37
Injecting external system with poor man's DI
This file contains 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 DefaultIntegrationTests | |
{ | |
[Test] | |
public void SetSomethingLabel() | |
{ | |
const string response = "something"; | |
var classA = new ClassA(new ClassB(new MockRestService { Response = response })); | |
var defaultPage = new _Default(classA); | |
defaultPage.Page_Load(this, new EventArgs()); | |
Assert.That(defaultPage.SomethingLabel.Text, Is.EqualTo(response)); | |
} | |
} | |
public class MockRestService : IRestService | |
{ | |
public string Response { get; set; } | |
public string GetDataFromRestService() | |
{ | |
return this.Response; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment