Exemplo n.º 1
0
 public Bot(IWeapon weapon, ILegs legs, IEyes eyes, ICellphone cellphone)
 {
     _legs      = legs;
     _eyes      = eyes;
     _weapon    = weapon;
     _cellphone = cellphone;
 }
Exemplo n.º 2
0
 public void Constructor(ICellphone cellphoneBuilder)
 {
     cellphoneBuilder.BuildBattery();
     cellphoneBuilder.BuildCamera();
     cellphoneBuilder.BuildDisplay();
     cellphoneBuilder.BuildSystem();
 }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        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);
            });
        }