Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oinant/1a8426c1e1647efe7616 to your computer and use it in GitHub Desktop.
Save oinant/1a8426c1e1647efe7616 to your computer and use it in GitHub Desktop.
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