Last active
August 29, 2015 13:56
-
-
Save yemrekeskin/8982331 to your computer and use it in GitHub Desktop.
FluentTestProcessor - code sample for Fluent Interface
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 TestProcessorOutput | |
| { | |
| public string ScreenTestOutputMessage { get; set; } | |
| public string StoredProcedureTestOutputMessage { get; set; } | |
| public string RunOutPutFileValidationTestOutputMessage { get; set; } | |
| public string RunInputFilevalidationTestOutputMessage { get; set; } | |
| } | |
| public interface ITestProcessor | |
| { | |
| ITestProcessor RunScreenTests(); | |
| ITestProcessor RunStoredProcedureTests(); | |
| ITestProcessor RunOutPutFileValidationTests(); | |
| ITestProcessor RunInputFilevalidationTests(); | |
| TestProcessorOutput TakeResults(); | |
| } | |
| public class TestProcessor | |
| : ITestProcessor | |
| { | |
| public TestProcessorOutput TestOutput { get; private set; } | |
| public TestProcessor(TestProcessorOutput testOutput) | |
| { | |
| this.TestOutput = testOutput; | |
| } | |
| public ITestProcessor RunScreenTests() | |
| { | |
| // testleri çalıştırır | |
| this.TestOutput.ScreenTestOutputMessage = ""; | |
| return this; | |
| } | |
| public ITestProcessor RunStoredProcedureTests() | |
| { | |
| // testleri çalıştırır | |
| this.TestOutput.StoredProcedureTestOutputMessage = ""; | |
| return this; | |
| } | |
| public ITestProcessor RunOutPutFileValidationTests() | |
| { | |
| // testleri çalıştırır | |
| this.TestOutput.RunOutPutFileValidationTestOutputMessage = ""; | |
| return this; | |
| } | |
| public ITestProcessor RunInputFilevalidationTests() | |
| { | |
| // testleri çalıştırır | |
| this.TestOutput.RunInputFilevalidationTestOutputMessage = ""; | |
| return this; | |
| } | |
| public TestProcessorOutput TakeResults() | |
| { | |
| return this.TestOutput; | |
| } | |
| } | |
| public static class FluentTestFactory | |
| { | |
| public static ITestProcessor Init() | |
| { | |
| return new TestProcessor(new TestProcessorOutput()); | |
| } | |
| } | |
| // using of it | |
| var testOutputs = FluentTestFactory | |
| .Init() | |
| .RunInputFilevalidationTests() | |
| .RunOutPutFileValidationTests() | |
| .RunScreenTests() | |
| .RunStoredProcedureTests() | |
| .TakeResults(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment