示例#1
0
 public void Setup()
 {
     // Make fresh copies for each test
     _fakeRoulette = Substitute.For <IRoulette>();
     _fakeOutput   = Substitute.For <IOutput>();
     _uut          = new RouletteGame.Game.Game(_fakeRoulette, _fakeOutput);
 }
示例#2
0
 public void Setup()
 {
     // Arrange
     _roulette = Substitute.For <IRoulette>();
     _uut      = new RouletteGame(_roulette);
     _roulette.GetResult().Returns(new Field(4, Field.Black));
 }
 public RouletteController(IRoulette _Roullete, IRedisCache _IRedisCache, IConfiguration _IConfiguration)
 {
     _Roulette       = _Roullete;
     _RedisCache     = _IRedisCache;
     _Configuration  = _IConfiguration;
     _ExpirationTime = TimeSpan.FromSeconds(Convert.ToInt32(_Configuration["RedisConfig:ExpirationTime"]));
 }
示例#4
0
 public BetServices(IComponentContext components)
 {
     this.components    = components;
     rouletteRepository = components.Resolve <IRoulette>();
     betRepository      = components.Resolve <IBet>();
     playerRepository   = components.Resolve <IPlayer>();
 }
示例#5
0
        public void ModifyRoulette(IRoulette newRoulette)
        {
            var filter = Builders <RouletteDocument> .Filter.Eq("RouletteId", newRoulette.GetId());

            var update = Builders <RouletteDocument> .Update.Set("State", (int)newRoulette.GetState());

            rouletteContext.Roulettes.UpdateOne(filter, update);
        }
 public void Setup()
 {
     _roulette = Substitute.For <IRoulette>();
     _uut      = new RouletteGame(_roulette);
     _roulette.GetResult().Returns(new Field(2, Field.Black));
     _fieldBet = Substitute.For <IFieldBet>();
     _fieldBet.PlayerName.Returns("TestPlayer");
 }
 public override Task <IRoulette> CreateAsync(IRoulette entity)
 {
     return(Task.Run(() =>
     {
         Redis.SaveObject(entity);
         return entity;
     }));
 }
示例#8
0
 public servicesRepository(IDBAcces dbAccess)
 {
     BetRoulette            = new betRouletteBusinnes(dbAccess);
     Roulette               = new rouletteBusinnes(dbAccess);
     openingClousingRoulete = new openingClousingRouleteBusinnes(dbAccess);
     betRouletteXColour     = new betRouletteXColourBusinnes(dbAccess);
     betRouletteXNumber     = new betRouletteXNumberBusinnes(dbAccess);
 }
示例#9
0
        public void CreateNewRoulette(IRoulette newRoulette)
        {
            var roulette = new RouletteDocument
            {
                RouletteId = newRoulette.GetId(),
                State      = (int)newRoulette.GetState()
            };

            rouletteContext.Roulettes.InsertOne(roulette);
        }
示例#10
0
        private void SerializeData(IRoulette roulette)
        {
            // Set the path to the file and write it, overwriting the previous file if it exists.
            var path = RouletteGamePath;

            using var file =
                      File.CreateText(path);
            var serializer = new JsonSerializer();

            serializer.Serialize(file, roulette);
        }
示例#11
0
        public void createMockObject()
        {
            Mock <IRoulette> mockRoulette = new Mock <IRoulette>();

            roulette = mockRoulette.Object;
            mockRoulette.Setup(r => r.Spin()).Returns(7);

            Mock <IGambler> mockGambler = new Mock <IGambler>();

            gambler = mockGambler.Object;
        }
示例#12
0
        public void SpinRouletteTest()
        {
            Mock <IRoulette> mockRoulette = new Mock <IRoulette>();
            IRoulette        roulette     = mockRoulette.Object;

            mockRoulette.Setup(r => r.Spin()).Returns(7);

            Croupier croupier = new Croupier(roulette);

            croupier.spinRoulette();
            Assert.IsTrue(croupier.getRouletteNumber() == 7);
        }
示例#13
0
        public Roulette(string path)
        {
            GameDataPath     = path;
            RouletteGamePath = GameDataPath + "/roulette.json";

            if (!File.Exists(RouletteGamePath))
            {
                File.Create(RouletteGamePath).Close();
                RouletteGame = new IRoulette
                {
                    Round   = Rand.Next(0, 6),
                    Players = new List <Player>(),
                    Played  = new List <Int64>()
                };
            }
            else
            {
                RouletteGame = LoadRoulette();
            }
        }
示例#14
0
 public Croupier(IRoulette roulette)
 {
     this.roulette = roulette;
 }
        public void Init()
        {
            roulette = Substitute.For <IRoulette>();

            uut = new Library.RouletteGame(roulette);
        }
示例#16
0
 public RouletteNumerator(IRoulette roulette)
 {
     this._roulette = roulette;
 }
示例#17
0
 public RouletteController(IRoulette _roulette)
 {
     this.roulette = _roulette;
 }
 public RouletteGame(IRoulette roulette, IConsoleWriter consoleWriter)
 {
     _bets          = new List <IBet>();
     _consoleWriter = consoleWriter;
     _roulette      = roulette;
 }
示例#19
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="roulette">Set by mocking tool</param>
 public GamesController(IRoulette roulette)
 {
     _rouletteGame = roulette;
 }
示例#20
0
 public RouletteGame(IRoulette roulette, IOutputDevice outputDevice)
 {
     _bets = new List<IBet>();
     _roulette = roulette;
     _outputDevice = outputDevice;
 }
 public RouletteController(IDataAccess client, IRoulette domain)
 {
     domain.GetDataAccess(client);
     _domain = domain;
 }
 public RouletteGame(IRoulette roulette)
 {
     _bets = new List<Bet>();
     _roulette = roulette;
 }
示例#23
0
 public RouletteGame(IRoulette roulette, List <IBet> bets)
 {
     _bets     = bets;
     _roulette = roulette;
 }
 public Roulettespil(IRoulette roulette)
 {
     _bets     = new List <IBet>();
     _roulette = roulette;
 }
示例#25
0
 public RouletteGame(IRoulette roulette)
 {
     _bets     = new List <Bet>();
     _roulette = roulette;
 }
 public RouletteServices(IComponentContext components)
 {
     this.components    = components;
     rouletteRepository = components.Resolve <IRoulette>();
 }
示例#27
0
 public Game(IRoulette roulette, IOutput output)
 {
     _bets     = new List <IBet>();
     _roulette = roulette;
     _output   = output;
 }
示例#28
0
 public RouletteGame(IRoulette roulette)
 {
     _bets = new List<IBet>();
     _roulette = roulette;
     uiOutput = new ConsoleUI();
 }
示例#29
0
 public RouletteGame(IRoulette roulette, IOutputDevice outputDevice)
 {
     _bets         = new List <IBet>();
     _roulette     = roulette;
     _outputDevice = outputDevice;
 }
示例#30
0
 public RouletteGame(IRoulette roulette, UI output)
 {
     _bets = new List<IBet>();
     _roulette = roulette;
     uiOutput = output;
 }