public interface IYoMamaService
{
bool IsSoFat { get; }
}
public interface IYoMamaServiceConfig
{
int SoFatSize { get; }
}
public interface IMamaDataSource
{
int Weigh();
}
public class FrazzleService : IYoMamaService
{
private readonly IYoMamaServiceConfig config;
// OR
private readonly int soFatSize;
private readonly IMamaDataSource ds;
public FrazzleService(IYoMamaServiceConfig config, IMamaDataSource ds)
{
if (config == null)
{
throw new ArgumentNullException(config, "WAT");
}
if (ds == null)
{
throw new ArgumentNullException("ds", "WAT");
}
this.config = config;
// OR
this.soFatSize = config.SoFatSize;
this.ds = ds;
}
public bool IsSoFat
{
get
{
return ds.Weigh() > config.SoFatSize;
// OR
return ds.Weigh() > soFatSize;
}
}
}
Last active
July 30, 2016 14:57
-
-
Save lukebakken/1a77dd6ebc515753ef7170e841a22f62 to your computer and use it in GitHub Desktop.
di-configure-object
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment