Example #1
0
        public override void RunApp()
        {
            _writter = new ConsoleWritter();
            var cells = new AbstractCell[10, 10];

            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    if (i + j%2 == 0)
                    {
                        cells[i, j] = new ProxyMine(i, j);
                    }
                    else
                    {
                        cells[i, j] = new EmptyProxy(i, j);
                    }
                }
            }

            //Open
            for (var i = 0; i < 10; i++)
            {
                for (var j = 0; j < 10; j++)
                {
                    //this case will be run after cells start drawing
                    cells[i, j].Open();
                }
            }
        }
Example #2
0
        public override void RunApp()
        {
            _output = new ConsoleWritter();

            var task1 = new Task(true, "first task", DateTime.Now, DateTime.MaxValue);

            var task2 = new Task(false, "Second task", DateTime.Now, DateTime.Now.Add(new TimeSpan(0, 15, 0)));

            var list = new ListTask(new List<Task>());
            list.AddTask(task1);
            list.AddTask(task2);

            _output.WriteLine("List task///");
            var iteratorlist = list.GetIterator();
            while (iteratorlist.HasNext())
            {
                _output.WriteLine(iteratorlist.Next().ToString());
            }

            _output.WriteLine("Array task///");

            var task = new ArrayTask(new[]{task1,task2}, 0);
            iteratorlist = task.ArrayIterator();
            while (iteratorlist.HasNext())
            {
                _output.WriteLine(iteratorlist.Next().ToString());
            }
        }
 public AddPhoneCommand(
     IOutputWritter outputWritter, 
     ICanonicalPhoneConverter canonicalPhoneConverter, 
     IPhonebookRepository phonebook)
     : base(outputWritter, canonicalPhoneConverter, phonebook)
 {
 }
Example #4
0
        static void Main(string[] args)
        {
            IKernel _kernel = new StandardKernel();

            _kernel.Load(Assembly.GetExecutingAssembly());
            ICSVRepository <IPerson, IFrequency, IAddress> _repo = _kernel.Get <ICSVRepository <IPerson, IFrequency, IAddress> >();
            IOutputWritter _writter        = _kernel.Get <IOutputWritter>();
            var            frequencies     = _repo.GetNameFrequency();
            var            sortedAddresses = _repo.GetSortedAddresses();

            StringBuilder sbfr   = new StringBuilder();
            StringBuilder sbsort = new StringBuilder();

            foreach (var fr in frequencies)
            {
                sbfr.AppendLine(String.Format("{0},{1}", fr.Value, fr.Count));
            }
            foreach (var adr in sortedAddresses)
            {
                sbsort.AppendLine(String.Format("{0}", adr.FullAddress));
            }
            ShowNameFrequency(frequencies);
            ShowSortedAddresses(sortedAddresses);
            _writter.WriteToOutPutFile(sbfr);
            _writter.WriteToOutPutFile(sbsort);
            Console.WriteLine("Opening Output Folder");
            Console.WriteLine("Press any key to exit and open the Output Folder....");
            Console.ReadKey();
            _writter.OpenLogDirectory();
        }
Example #5
0
 public TransactionsFeeDataGenerator(ITransactionData transactionData, IDataGenerator dataGenerator, IFeeCalculator feeCalculator, IOutputWritter outputWritter)
 {
     _transactionData = transactionData;
     _dataGenerator   = dataGenerator;
     _feeCalculator   = feeCalculator;
     _consoleWritter  = outputWritter;
 }
Example #6
0
 public Letter(IOutputWritter writter, string @from, string to)
     : base(writter)
 {
     _writter = writter;
     To = to;
     From = @from;
 }
Example #7
0
        public void WriteToOutPutFileTest()
        {
            IKernel _kernel = new StandardKernel();

            _kernel.Load(Assembly.GetExecutingAssembly());
            ICSVRepository <IPerson, IFrequency, IAddress> _repo = _kernel.Get <ICSVRepository <IPerson, IFrequency, IAddress> >();
            IOutputWritter _writter = _kernel.Get <IOutputWritter>();

            var frequencies     = _repo.GetNameFrequency();
            var sortedAddresses = _repo.GetSortedAddresses();

            StringBuilder sbfr   = new StringBuilder();
            StringBuilder sbsort = new StringBuilder();

            foreach (var fr in frequencies)
            {
                sbfr.AppendLine(String.Format("{0},{1}", fr.Value, fr.Count));
            }
            foreach (var adr in sortedAddresses)
            {
                sbsort.AppendLine(String.Format("{0}", adr.FullAddress));
            }

            _writter.WriteToOutPutFile(sbfr);
            _writter.WriteToOutPutFile(sbsort);

            Assert.IsTrue(Directory.GetFiles(Environment.CurrentDirectory + @"\Output", "Output*.csv").Length == 2);
        }
Example #8
0
 public Task(string @do, string name, IOutputWritter writter)
 {
     Name = name;
     _writter = writter;
     Do = @do;
     _behavior = new List<AbstractBehavior>();
 }
Example #9
0
 public Email(IOutputWritter writter, string to, string @from, string theme)
     : base(writter)
 {
     _writter = writter;
     Theme = theme;
     From = @from;
     To = to;
 }
 public CommandFactory(
     IOutputWritter outputWritter, 
     ICanonicalPhoneConverter canonicalPhoneConverter, 
     IPhonebookRepository phonebook)
 {
     this.canonicalPhoneConverter = canonicalPhoneConverter;
     this.outputWritter = outputWritter;
     this.phonebookRepository = phonebook;
 }
 protected BasePhoneCommand(
     IOutputWritter outputWritter, 
     ICanonicalPhoneConverter canonicalPhoneConverter, 
     IPhonebookRepository phonebook)
 {
     this.CanonicalPhoneConverter = canonicalPhoneConverter;
     this.OutputWritter = outputWritter;
     this.PhonebookRepository = phonebook;
 }
Example #12
0
        public LettersReader(IOutputWritter writter)
        {
            if (writter == null)
            {
                throw new ArgumentNullException(nameof(writter));
            }

            this.writter = writter;
        }
 public PhonebookManager(
     string defaultCountryCode, 
     IOutputWritter resultReporter, 
     ICommandExecutor commandExecutor)
 {
     this.defaultCountryCode = defaultCountryCode;
     this.resultReporter = resultReporter;
     this.commandExecutor = commandExecutor;
 }
 public Engine(IBuildingFactory buildingFactory, IUnitFactory unitFactory, IResourceFactory resourceFactory, EmpireDatabase database,
               IInputReader reader, IOutputWritter writter)
 {
     this.buildingFactory = buildingFactory;
     this.unitFactory     = unitFactory;
     this.resourceFactory = resourceFactory;
     this.database        = database;
     this.reader          = reader;
     this.writter         = writter;
 }
 public PhonebookManager()
 {
     this.resultReporter = new OutputWritter(new StringBuilder());
     this.commandExecutor =
         new CommandExecutor(
             new CommandFactory(
                 this.resultReporter, 
                 new CanonicalPhoneConverter(this.defaultCountryCode), 
                 new PhonebookRepository()));
 }
Example #16
0
 public GumMachine(int balls, IOutputWritter writter)
 {
     _balls = balls;
     _writter = writter;
     SoldOut = new SoldOutState(this,_writter);
     NoPenny = new NoPennyState(this, _writter);
     Sold = new SoldState(this, _writter);
     HasPenny = new HasPennyState(_writter, this);
     CurrentState = _balls<=0 ? SoldOut : NoPenny;
 }
Example #17
0
 protected SpyAgent(string name, IOutputWritter writter)
 {
     Name = name;
     _writter = writter;
 }
Example #18
0
 /// <summary>
 /// Case of agent. 
 /// </summary>
 /// <param name="name"></param>
 /// <param name="writter"></param>
 public James(string name, IOutputWritter writter)
     : base(name, writter)
 {
 }
Example #19
0
 public HasPennyState(IOutputWritter writter, GumMachine gumMachine)
 {
     _writter = writter;
     _gumMachine = gumMachine;
 }
Example #20
0
 public MyHomeComputer(IOutputWritter writtter)
 {
     _writter = writtter;
 }
Example #21
0
 /// <summary>
 /// Case of Agent (Aegnt Tanya)
 /// </summary>
 /// <param name="name">Agent names</param>
 /// <param name="writter">Output</param>
 public Tanya(string name, IOutputWritter writter)
     : base(name, writter)
 {
 }
 public LettersReaderTests()
 {
     this.writter = Substitute.For<IOutputWritter>();
     this.reader = new LettersReader(this.writter);
 }
Example #23
0
 public NoPennyState(GumMachine gumMachine, IOutputWritter writter)
 {
     _gumMachine = gumMachine;
     _writter = writter;
 }
Example #24
0
 public Stereo(IOutputWritter writter)
 {
     _writter = writter;
     Active = false;
     Volume = 0;
 }
Example #25
0
 protected Weapon(int damage, string name, IOutputWritter writter)
 {
     Damage = damage;
     Name = name;
     _writter = writter;
 }
Example #26
0
 protected Primitive(IOutputWritter writter)
 {
     _writter = writter;
 }
 public CalculatorGui(ICalculator calculator, IInputReader inputReader, IOutputWritter outputWritter)
 {
     this.calculator = calculator;
     this.inputReader = inputReader;
     this.outputWritter = outputWritter;
 }
Example #28
0
 public Transmission(IOutputWritter writter)
 {
     _writter = writter;
     Status = TransmissonStatus.Auto;
     Gear = Gears.N;
 }
Example #29
0
 public Sword(string name, int dmg, IOutputWritter writter)
     : base(dmg,name, writter)
 {
     Type = new SwordType();
 }
Example #30
0
 public MySmartPhone(IOutputWritter writter)
 {
     _writter = writter;
 }
Example #31
0
 protected PostBehavior(IOutputWritter writter)
 {
     _writter = writter;
 }
Example #32
0
 public Engine(IOutputWritter writter)
 {
     Active = false;
     _writter = writter;
 }
Example #33
0
 public SoldState(GumMachine machine, IOutputWritter writter)
 {
     _machine = machine;
     _writter = writter;
 }
Example #34
0
 public Bone(string name,int dmg, IOutputWritter writter)
     : base(dmg, name, writter)
 {
     Type = new BoneType();
 }