Exemple #1
0
 public Play(INumberGenerator numberGenerator, IPlayContext context)
 {
     _numberGenerator = numberGenerator;
     _context         = context;
     InitExamStore();
     //InitCheckStore();
 }
Exemple #2
0
        public Roulette(ulong rouletteNumber, int minNumber, int numbersCount, INumberGenerator numberGenerator =
                        default, HashAlgorithm hashAlgorithm = default)
        {
            if (minNumber < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(minNumber));
            }
            if (numbersCount <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(numbersCount));
            }

            RouletteNumber = rouletteNumber;
            MinNumber      = minNumber;
            NumbersCount   = numbersCount;

            if (numberGenerator != default)
            {
                _numberGenerator = numberGenerator;
            }
            if (hashAlgorithm != default)
            {
                _hashAlgorithm = hashAlgorithm;
            }
        }
        protected LocalGameController CreateLocalGameController(INumberGenerator dice, IPlayerFactory playerPool, IDevelopmentCardHolder developmentCardHolder)
        {
            var localGameControllerCreator = new LocalGameControllerCreator();

            if (dice != null)
            {
                localGameControllerCreator.ChangeDice(dice);
            }

            if (playerPool != null)
            {
                localGameControllerCreator.ChangePlayerPool(playerPool);
            }

            if (developmentCardHolder != null)
            {
                localGameControllerCreator.ChangeDevelopmentCardHolder(developmentCardHolder);
            }

            var localGameController = localGameControllerCreator.Create();

            localGameController.ErrorRaisedEvent = (ErrorDetails e) => { throw new Exception(e.Message); };

            return(localGameController);
        }
Exemple #4
0
        public Horse(string n, INumberGenerator numberGenerator2)
        {
            _numberGenerator = numberGenerator2;

            horseName = n;
            speed     = _numberGenerator.Next(1, 1001);
        }
Exemple #5
0
 public CommandHandler(IWorkflowApplier <Domain.Entities.Contract.Contract> workflowApplier, IMapper mapper, NiisWebContext context, INumberGenerator numberGenerator)
 {
     _workflowApplier = workflowApplier;
     _mapper          = mapper;
     _context         = context;
     _numberGenerator = numberGenerator;
 }
 public CommandHandler(
     NiisWebContext context,
     INumberGenerator generator)
 {
     _context   = context;
     _generator = generator;
 }
Exemple #7
0
 public Generator(INumberGenerator numberGenerator, IFamilyGenerator familyGenerator,
                  IEducationInstitutePicker educationInstitutePicker)
 {
     NumberGenerator          = numberGenerator;
     FamilyGenerator          = familyGenerator;
     EducationInstitutePicker = educationInstitutePicker;
 }
 public GuessingNumbersGame()
 {
     NumberGenerator  = new NumberGenerator();
     PerformerGame    = new PerformerGame();
     ResultDisplay    = new ResultDisplay(new FakeConsole());
     ProgramExecution = new DecisionOnFurtherCourseOfProgram(this);
 }
Exemple #9
0
        }                           // For use when inflating from file.

        public ComputerPlayer(string name, GameBoard gameBoard, LocalGameController localGameController, INumberGenerator numberGenerator) : base(name)
        {
            this.gameBoard           = gameBoard;
            this.numberGenerator     = numberGenerator;
            this.decisionMaker       = new DecisionMaker(this.numberGenerator);
            this.localGameController = localGameController;
        }
Exemple #10
0
        public void Test_GetNextAutoIncrementingNumber_WhenNoNumberGeneratorForClassDef_ShouldCreateNumberGenerator()
        {
            //---------------Set up test pack-------------------
            DataStoreInMemory dataStoreInMemory = new DataStoreInMemory();

            BORegistry.DataAccessor = new DataAccessorInMemory(dataStoreInMemory);
            IClassDef        classDef        = MockRepository.GenerateStub <IClassDef>();
            IClassDef        classDef2       = MockRepository.GenerateStub <IClassDef>();
            INumberGenerator numberGenerator = MockRepository.GenerateStub <INumberGenerator>();

            dataStoreInMemory.AutoIncrementNumberGenerators.Add(classDef, numberGenerator);
            //---------------Assert Precondition----------------
            Assert.AreEqual(1, dataStoreInMemory.AutoIncrementNumberGenerators.Count);
            Assert.AreSame(numberGenerator, dataStoreInMemory.AutoIncrementNumberGenerators[classDef]);
            Assert.IsFalse(dataStoreInMemory.AutoIncrementNumberGenerators.ContainsKey(classDef2));
            //---------------Execute Test ----------------------
            long defaultNumber = dataStoreInMemory.GetNextAutoIncrementingNumber(classDef2);

            //---------------Test Result -----------------------
            Assert.AreEqual(2, dataStoreInMemory.AutoIncrementNumberGenerators.Count);
            numberGenerator.AssertWasNotCalled(t => t.NextNumber());
            Assert.AreEqual(1, defaultNumber);
            INumberGenerator createdNumberGenerator = dataStoreInMemory.AutoIncrementNumberGenerators[classDef2];

            Assert.IsNotNull(createdNumberGenerator);
            TestUtil.AssertIsInstanceOf <NumberGenerator>(createdNumberGenerator);
        }
Exemple #11
0
 public DbNumeratorRepository(IDbContextFactory dbContextFactory,
                              IClassifierTypeService classifierTypeService, IClassifierTreeService classifierTreeService,
                              IClassifierTypeMetadataService metadataService, IFieldDataRepository fieldDataRepository,
                              INumberGenerator numberGenerator)
     : base(dbContextFactory, classifierTypeService, classifierTreeService, metadataService, fieldDataRepository,
            numberGenerator)
 {
 }
Exemple #12
0
 public YahtzeeDice(INumberGenerator numberGenerator)
 {
     _numberGenerator = numberGenerator;
     dice             = new List <int> {
         0, 0, 0, 0, 0
     };
     RollCount = 0;
 }
Exemple #13
0
 public CreateBusinessHandler(IBusinessRepository repository, IVmsLogger <CreateBusinessHandler> logger, IServiceBusMessagePublisher publisher, IBusinessesFactory businessesFactory, INumberGenerator numberGenerator)
 {
     _repository        = repository;
     _logger            = logger;
     _publisher         = publisher;
     _businessesFactory = businessesFactory;
     _numberGenerator   = numberGenerator;
 }
Exemple #14
0
 public ReportGenerator(
     INumberGenerator numberGenerator,
     IDateGenerator dateGenerator,
     IRepository <Employee> employeesRepository)
 {
     this.numberGenerator     = numberGenerator;
     this.dateGenerator       = dateGenerator;
     this.employeesRepository = employeesRepository;
 }
Exemple #15
0
        /// <summary>Default constructor.</summary>
        public GameEngine()
        {
            isGameOver = true;

            renderer        = new ConsoleRenderer();
            inputReader     = new ConsoleReader();
            scoreboard      = Scoreboard.Instance;
            numberGenerator = new NumberGenerator(CommonConstants.GAME_BOARD_SIZE * CommonConstants.GAME_BOARD_SIZE);
        }
 public ActionsController(IDataState data, INotifier notifier, INumberGenerator numberGenerator, IScoreboard scoreboard, ICommandsFactory commandsFactory, IActionsReader reader)
 {
     this.Data = data;
     this.ActionsReader = reader;
     this.Notifier = notifier;
     this.Scoreboard = scoreboard;
     this.CommandsFactory = commandsFactory;
     this.NumberGenerator = numberGenerator;
 }
Exemple #17
0
 public void Shuffle(INumberGenerator _generator)
 {
     _deck = new PokerDeck(_generator);
     deck  = new Stack <int>();
     foreach (var card in _deck.cards)
     {
         deck.Push(card);
     }
 }
 public CommandsFactory(IDataState data, INotifier notifier, INumberGenerator numberGenerator, IScoreboard scoreboard)
 {
     this.Data = data;
     this.Notifier = notifier;
     this.Scoreboard = scoreboard;
     this.NumberGenerator = numberGenerator;
     this.CommandsList = new Dictionary<string, ICommand>();
     this.FourDigitNumberPattern = new Regex(FourDigitsPatternForRegex);
 }
Exemple #19
0
 public EmployeeGenerator(
     INumberGenerator numberGenerator,
     IStringGenerator stringGenerator,
     IRepository <Department> departmentsRepository)
 {
     this.numberGenerator       = numberGenerator;
     this.stringGenerator       = stringGenerator;
     this.departmentsRepository = departmentsRepository;
 }
Exemple #20
0
 public ScenarioGameManager(
     INumberGenerator numberGenerator,
     GameBoard gameBoard,
     IDevelopmentCardHolder developmentCardHolder,
     IPlayerFactory playerFactory,
     IEventSender eventSender,
     GameOptions gameOptions)
     : base(numberGenerator, gameBoard, developmentCardHolder, playerFactory, eventSender, gameOptions)
 {
 }
Exemple #21
0
        public SingleRollResult Simulate(INumberGenerator numberGenerator)
        {
            var number = numberGenerator.GetNumber();

            number = Math.Abs(number);

            var remainder = number % TotalSides;

            return(new SingleRollResult(this, remainder == 0 ? TotalSides : remainder));
        }
Exemple #22
0
        private void InitContext()
        {
            //_context?.Dispose();

            var builder = new DbContextOptionsBuilder <NiisWebContext>();

            builder.UseSqlServer(_connectionString);
            _context         = new NiisWebContext(builder.Options);
            _numberGenerator = new NumberGenerator(_context);
        }
 public GuessingNumbersGame(INumberGenerator NumberGenerator,
                            IPerformerGame PerformerGame,
                            IResultDisplay ResultDisplay,
                            IDecisionOnFurtherCourseOfProgram ProgramExecution)
 {
     this.NumberGenerator  = NumberGenerator;
     this.PerformerGame    = PerformerGame;
     this.ResultDisplay    = ResultDisplay;
     this.ProgramExecution = ProgramExecution;
 }
        public NumberSenderService(IEventPublisher eventPublisher, INumberGenerator numberGenerator, NumberSenderSettings settings)//
        {
            this._eventPublisher  = eventPublisher;
            this._numberGenerator = numberGenerator;
            this._settings        = settings;

            Console.WriteLine($"Initializing Numbersender, sending time: {this._settings.Duration}ms with {this._settings.TimeBetweenSending}ms intervall");
            Console.WriteLine("wait a few seconds until mosquitto broker is up an running..");
            System.Threading.Thread.Sleep(5000);
        }
        public static string[] GenerateRandomGrid(INumberGenerator numberGenerator)
        {
            var emptyGrid = GenerateStartingGrid();

            var populatedGrid = GenerateGrid(numberGenerator, emptyGrid);

            populatedGrid = AddSpecialPieces(numberGenerator, populatedGrid);

            return(ToStringArray(populatedGrid));
        }
Exemple #26
0
 public ProjectGenerator(
     INumberGenerator numberGenerator,
     IStringGenerator stringGenerator,
     IDateGenerator dateGenerator,
     IRepository <Employee> employeesRepository)
 {
     this.numberGenerator    = numberGenerator;
     this.stringGenerator    = stringGenerator;
     this.dateGenerator      = dateGenerator;
     this.employeeRepository = employeesRepository;
 }
Exemple #27
0
        public Guid StartGame(int nrOfDigits, INumberGenerator numberGenerator)
        {
            // TODO: Check whether a player can start a new game when the previous one isn't finished

            var game = new Game(nrOfDigits, numberGenerator);

            _games.Add(game);
            game.GameCompleted += (o, e) => OnGameCompleted(EventArgs.Empty);
            OnGameStarted(new GameStartedEventArgs(game));
            return(game.Id);
        }
 public IntegrationDocumentHelper(
     NiisWebContext niisContext,
     INumberGenerator numberGenerator,
     IntegrationDictionaryHelper integrationDictionaryHelper,
     AppConfiguration configuration)
 {
     _niisContext                 = niisContext;
     _numberGenerator             = numberGenerator;
     _integrationDictionaryHelper = integrationDictionaryHelper;
     _configuration               = configuration;
 }
        private static List <GeneratedSpace> AddSpecialPieces(INumberGenerator numberGenerator, List <GeneratedSpace> populatedGrid)
        {
            var numberOfSpecialPieces = numberGenerator.Range(0, 15);

            for (int i = 0; i < numberOfSpecialPieces; i++)
            {
                populatedGrid[numberGenerator.Range(0, populatedGrid.Count)].PieceType = GetRandomSpecialPiece(numberGenerator);
            }

            return(populatedGrid);
        }
        public GameManager(IPhraseProvider phraseProvider, IInputOutputProvider inputOutputProvider, INumberGenerator numberGenerator, ISettingsProvider settingsProvider)
        {
            this.phraseProvider      = phraseProvider;
            this.inputOutputProvider = inputOutputProvider;
            this.numberGenerator     = numberGenerator;
            this.settingsProvider    = settingsProvider;

            _settings = settingsProvider.GetSettings();
            phraseProvider.SetLanguage(_settings.LanguageFile);
            isRestarting = false;
        }
Exemple #31
0
        public powerball(INumberGenerator numberGenerator2)
        {
            _numberGenerator = numberGenerator2;

            for (int i = 0; i < SIZE; i++)
            {
                this.pbList[i] = _numberGenerator.Next(1, 70);
            }

            power_b = _numberGenerator.Next(1, 27);
        }
Exemple #32
0
 public DbClassifierRepository(IDbContextFactory dbContextFactory, IClassifierTypeService classifierTypeService,
                               IClassifierTreeService classifierTreeService, IClassifierTypeMetadataService metadataService,
                               IFieldDataRepository fieldDataRepository, INumberGenerator numberGenerator)
 {
     _dbContextFactory      = dbContextFactory;
     _classifierTypeService = classifierTypeService;
     _classifierTreeService = classifierTreeService;
     _metadataService       = metadataService;
     _fieldDataRepository   = fieldDataRepository;
     _numberGenerator       = numberGenerator;
 }
Exemple #33
0
 public Keygen(INumberGenerator random)
 {
     this.random = random;
 }
Exemple #34
0
 protected Config(INumberGenerator random)
 {
     this.random = random;
 }
 public LottoWinnerGenerator(INumberGenerator numberGenerator)
 {
     _numberGenerator = numberGenerator;
 }
 public EnglishTownGenerator(INumberGenerator numberGenerator, IFileDataProvider fileDataProvider)
 {
     this.numberGenerator = numberGenerator;
     this.fileDataProvider = fileDataProvider;
 }
 public PhoneNumberGenerator(INumberGenerator numberGenerator)
 {
     this.numberGenerator = numberGenerator;
 }
 public InjectingMiddleware(RequestDelegate next, INumberGenerator generator)
 {
     _next = next;
     this.generator = generator;
 }
 public TokenReplacement(INumberGenerator numberGenerator, ICharacterGenerator characterGenerator)
 {
     this.numberGenerator = numberGenerator;
     this.characterGenerator = characterGenerator;
 }
Exemple #40
0
 public Drawer(INumberGenerator random)
 {
     this.random = random;
 }
 public LoginNameGenerator(ICharacterGenerator characterGenerator, INumberGenerator numberGenerator, ILastNameGenerator lastNameGenerator)
 {
     this.characterGenerator = characterGenerator;
     this.numberGenerator = numberGenerator;
     this.lastNameGenerator = lastNameGenerator;
 }
 internal TableGenerator(INumberGenerator numberGenerator)
 {
     this.numberGenerator = numberGenerator;
 }
 /// <summary>
 /// Strictly for MOCKING in tests. Use the other constructor
 /// </summary>
 internal TableGenerator()
 {
     this.numberGenerator = null;
 }
 public AppendStringMiddleware(RequestDelegate next, INumberGenerator numberGenerator)
 {
     _next = next;
     this.numberGenerator = numberGenerator;
 }
 public InjectionMiddleware(RequestDelegate next, INumberGenerator numberGenerator)
 {
     _next = next;
     _numberGenerator = numberGenerator;
 }
 public SymbolGenerator(INumberGenerator numberGenerator, IFileDataProvider fileDataProvider)
 {
     this.numberGenerator = numberGenerator;
     this.fileDataProvider = fileDataProvider;
 }
 public ExpenseReportBuilder(INumberGenerator numberGenerator, ICalendar calendar)
 {
     _numberGenerator = numberGenerator;
     _calendar = calendar;
 }
 public PickListServiceAdvanced(INumberGenerator indexGenerator, IPickListRuleProvider rules, PersonCollection pickList)
 {
     ruleProvider = rules;
     familyList = pickList;
     this.indexGenerator = indexGenerator;
 }
 public AddressGenerator(INumberGenerator numberGenerator, IFileDataProvider fileDataProvider)
 {
     this.numberGenerator = numberGenerator;
     this.fileDataProvider = fileDataProvider;
 }
 public CheatCommand(IDataState data, INotifier notifier, INumberGenerator numberGenerator)
 {
     this.Data = data;
     this.Notifier = notifier;
     this.NumberGenerator = numberGenerator;
 }
 public LastNameGenerator(INumberGenerator numberGenerator, IFileDataProvider fileDataProvider)
 {
     this.numberGenerator = numberGenerator;
     this.fileDataProvider = fileDataProvider;
 }
 public CountryGenerator(INumberGenerator numberGenerator, IFileDataProvider fileDataProvider)
 {
     this.numberGenerator = numberGenerator;
     this.fileDataProvider = fileDataProvider;
 }