private static Computer _computer;
public static void Main()
_computer = new Computer();
_computer.Test(new MotherBoard(), new Cpu(), new Ram(), new HardDrive(), new PowerSupply());
private IMotherBoard _mb;
private IPowerSupply _ps;
public void Test(IMotherBoard mb, ICpu cpu, IRam ram, IHardDrive hd, IPowerSupply ps)
Console.WriteLine(this._mb.Motherboarding());
Console.WriteLine(this._cpu.Calculate());
Console.WriteLine(this._ram.StoringData());
Console.WriteLine(this._hd.WritingData());
Console.WriteLine(this._ps.ProducePower());
public interface IPowerSupply
internal class PowerSupply : IPowerSupply
public string ProducePower()
return "Producing Power";
public interface IHardDrive
internal class HardDrive : IHardDrive
public string WritingData()
internal class Ram : IRam
public string StoringData()
internal class Cpu : ICpu
public string Calculate()
public interface IMotherBoard
internal class MotherBoard : IMotherBoard
public string Motherboarding()
return "Connecting everything";