public Bot(IWeapon weapon, ILegs legs, IEyes eyes, ICellphone cellphone) { _legs = legs; _eyes = eyes; _weapon = weapon; _cellphone = cellphone; }
public void Constructor(ICellphone cellphoneBuilder) { cellphoneBuilder.BuildBattery(); cellphoneBuilder.BuildCamera(); cellphoneBuilder.BuildDisplay(); cellphoneBuilder.BuildSystem(); }
static void Main(string[] args) { Manufacturer man = new Manufacturer(); ICellphone cellphoneBuilder = null; cellphoneBuilder = new AndroidBuilder(); man.Constructor(cellphoneBuilder); Console.WriteLine($"Novo celular construído: {cellphoneBuilder.Cellphone.Name}"); Console.ReadKey(); }
static void Main(string[] args) { CellphoneFactory factory = new ConcreteCellphoneFactory(); ICellphone iphone = factory.GetCellphone("Iphone"); iphone.TurnOn(); ICellphone samsung = factory.GetCellphone("Samsung"); samsung.TurnOn(); ICellphone huawei = factory.GetCellphone("Huawei"); huawei.TurnOn(); Console.ReadKey(); }
public void SetUp() { _weapon = A.Fake <IWeapon>(); _legs = A.Fake <ILegs>(); _eyes = A.Fake <IEyes>(); _cellphone = A.Fake <ICellphone>(); _checkMobStatusResult = true; _mobLocation = 0; _reports = new List <Report>(); A.CallTo(() => _eyes.CheckForMob()).ReturnsLazily(() => _mobLocation); A.CallTo(() => _weapon.Strike()).Returns(1); A.CallTo(() => _eyes.CheckMobStatus()).ReturnsLazily(() => _checkMobStatusResult); A.CallTo(() => _cellphone.ReportResult(A <Report> .Ignored)) .Invokes((Report report) => { _reports.Add(report); }); }