Skip to content

Instantly share code, notes, and snippets.

Avatar

Antoine Sauvinet oinant

View GitHub Profile
View Blog.Factory.Part2.NetworkClientWithFactory.TestDouble.cs
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);
View Blog.Factory.Part2.NetworkClientWithFactory.cs
using ExternalLibrary;
namespace Oinant.Blog.Factory.ForTesting
{
public class NetworkClientWithMessageFactory
{
private readonly INetworkMessageFactory _networkMessageFactory;
public NetworkClientWithMessageFactory(INetworkMessageFactory networkMessageFactory)
{
View Blog.Factory.Part2.NetworkClientWithoutFactory.cs
using ExternalLibrary;
namespace Oinant.Blog.Factory.ForTesting
{
public class NetworkClientWithoutMessageFactory
{
public string SendRequest()
{
var message = new NetworkService().SendMessage();
View Blog.Factory.Part2.NetworkClientWithoutFactory
using ExternalLibrary;
namespace Oinant.Blog.Factory.ForTesting
{
public class NetworkClientWithoutMessageFactory
{
public string SendRequest()
{
var message = new NetworkService().SendMessage();
View Blog.Factory.part2.ExternalLib.cs
using System;
namespace ExternalLibrary
{
public class NetworkMessage
{
static readonly TimeSpan TimeToLive = TimeSpan.FromSeconds(10);
private readonly DateTime _creation;
private Status _status;
View BasicFactory.cs
using System;
namespace Oinant.Blog.Factory.SimpleExemple
{
public class MyBusinessObject
{
private string _content;
private DateTime _dateTimeReleventToBusinessLogic;
public MyBusinessObject(Tuple<DateTime, String> creationData)
{