Created
July 22, 2015 17:34
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
using ExternalLibrary; | |
using Oinant.Blog.Factory.ForTesting; | |
namespace Factory.Tests | |
{ | |
public class TestFactory : INetworkMessageFactory | |
{ | |
public NetworkMessage Create(Status status, object content) | |
{ | |
var message = new NetworkMessageDouble(status, content); | |
return message; | |
} | |
} | |
class NetworkMessageDouble : NetworkMessage | |
{ | |
private readonly Status _status; | |
private readonly object _content; | |
public NetworkMessageDouble(Status status, object content) : base(status, content) | |
{ | |
_status = status; | |
_content = content; | |
} | |
public new bool IsSuccess() | |
{ | |
return _status == Status.Succeeded; | |
} | |
public T GetContentAs<T>() where T : class | |
{ | |
return _content as T; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment