[Test] // red, black, green
        public void WonAmount_FieldColorIsGreenAndBetColorIsGreenAndAmountEquals10_ResultEquals20() 
        {
            //Arrange
            ColorBet uut = new ColorBet("Otto Leisner", 10, Field.Green); //amount = 10, color = 0
            Field testField = new Field(25, Field.Green); // Number = 25, Color = 0

            //Act
            var returnValue = uut.WonAmount(testField);

            //Assert
            Assert.AreEqual(20, returnValue);
        }
        public void WonAmount_FieldColorDoesNotEqualBetColor_ResultEqualsZero() // test for every color combination?
        {
            //Arrange
            ColorBet uut = new ColorBet("Otto Leisner", 10, Field.Red); //amount = 10, color = 0
            Field testField = new Field(5, Field.Black); // Number = 5, Color = 1

            //Act
            var returnValue = uut.WonAmount(testField);

            //Assert
            Assert.AreEqual(0, returnValue);
        }
        public void WonAmount_FieldNumberEqualsBetNumberAndAmountEquals10_ResultEquals360()
        {
            //Arrange
            NumberBet uut = new NumberBet("Otto Leisner", 10, 25); //amount = 10, field number = 25
            Field testField = new Field(25, 0); // Number = 25, Color = 0

            //Act
            var returnValue = uut.WonAmount(testField);

            //Assert
            Assert.AreEqual(360, returnValue);
        }
        public void WonAmount_FieldNumberDoesNotEqualBetNumber_ResultEqualsZero()
        {
            //Arrange
            NumberBet uut = new NumberBet("Otto Leisner", 10, 25); //amount = 10, field number = 25
            Field testField = new Field(5, 0); // Number = 5, Color = 0

            //Act
            var returnValue = uut.WonAmount(testField);

            //Assert
            Assert.AreEqual(0, returnValue);
        }
        public void WonAmount_BetOnEvenIsIncorrect_ResultEqualsZero()
        {
            //Arrange
            EvenOddBet uut = new EvenOddBet("Otto Leisner", 10, true); //amount = 10, even = true
            Field testField = new Field(3, 1); // Number = 2, Color = 1

            //Act
            var returnValue = uut.WonAmount(testField);

            //Assert
            Assert.AreEqual(0, returnValue);
        }
        public void WonAmount_BetOnOddIsCorrectAndAmountEquals10_ResultEquals20()
        {
            //Arrange
            EvenOddBet uut = new EvenOddBet("Otto Leisner", 10, false); //amount = 10, even = false
            Field testField = new Field(3, 0); // Number = 3, Color = 0

            //Act
            var returnValue = uut.WonAmount(testField);

            //Assert
            Assert.AreEqual(20, returnValue);
        }
Example #7
0
        public Roulette(IRandomize randomizer)
        {
            _randomize = randomizer;
            _fields = new List<Field>
                          {
                              new Field(0, Field.Green),
                              new Field(1, Field.Red),
                              new Field(2, Field.Black),
                              new Field(3, Field.Red),
                              new Field(4, Field.Black),
                              new Field(5, Field.Red),
                              new Field(6, Field.Black),
                              new Field(7, Field.Red),
                              new Field(8, Field.Black),
                              new Field(9, Field.Red),
                              new Field(10, Field.Black),
                              new Field(11, Field.Black),
                              new Field(12, Field.Red),
                              new Field(13, Field.Black),
                              new Field(14, Field.Red),
                              new Field(15, Field.Black),
                              new Field(16, Field.Red),
                              new Field(17, Field.Black),
                              new Field(18, Field.Red),
                              new Field(19, Field.Red),
                              new Field(20, Field.Black),
                              new Field(21, Field.Red),
                              new Field(22, Field.Black),
                              new Field(23, Field.Red),
                              new Field(24, Field.Black),
                              new Field(25, Field.Red),
                              new Field(26, Field.Black),
                              new Field(27, Field.Red),
                              new Field(28, Field.Black),
                              new Field(29, Field.Black),
                              new Field(30, Field.Red),
                              new Field(31, Field.Black),
                              new Field(32, Field.Red),
                              new Field(33, Field.Black),
                              new Field(34, Field.Red),
                              new Field(35, Field.Black),
                              new Field(36, Field.Red)
                          };

            _result = _fields[0];
        }
Example #8
0
        public Roulette()
        {
            _fields = new List<Field>();
            _fields.Add(new Field(0, Field.Green));
            _fields.Add(new Field(1, Field.Red));
            _fields.Add(new Field(2, Field.Black));
            _fields.Add(new Field(3, Field.Red));
            _fields.Add(new Field(4, Field.Black));
            _fields.Add(new Field(5, Field.Red));
            _fields.Add(new Field(6, Field.Black));
            _fields.Add(new Field(7, Field.Red));
            _fields.Add(new Field(8, Field.Black));
            _fields.Add(new Field(9, Field.Red));
            _fields.Add(new Field(10, Field.Black));
            _fields.Add(new Field(11, Field.Black));
            _fields.Add(new Field(12, Field.Red));
            _fields.Add(new Field(13, Field.Black));
            _fields.Add(new Field(14, Field.Red));
            _fields.Add(new Field(15, Field.Black));
            _fields.Add(new Field(16, Field.Red));
            _fields.Add(new Field(17, Field.Black));
            _fields.Add(new Field(18, Field.Red));
            _fields.Add(new Field(19, Field.Red));
            _fields.Add(new Field(20, Field.Black));
            _fields.Add(new Field(21, Field.Red));
            _fields.Add(new Field(22, Field.Black));
            _fields.Add(new Field(23, Field.Red));
            _fields.Add(new Field(24, Field.Black));
            _fields.Add(new Field(25, Field.Red));
            _fields.Add(new Field(26, Field.Black));
            _fields.Add(new Field(27, Field.Red));
            _fields.Add(new Field(28, Field.Black));
            _fields.Add(new Field(29, Field.Black));
            _fields.Add(new Field(30, Field.Red));
            _fields.Add(new Field(31, Field.Black));
            _fields.Add(new Field(32, Field.Red));
            _fields.Add(new Field(33, Field.Black));
            _fields.Add(new Field(34, Field.Red));
            _fields.Add(new Field(35, Field.Black));
            _fields.Add(new Field(36, Field.Red));

            _result = _fields[0];
        }
Example #9
0
 public void Spin()
 {
     var n = (uint) new System.Random().Next(0,37);
     _result = _fields[(int) n];
 }
Example #10
0
File: Bet.cs Project: dentych/I4SWT
 public override uint WonAmount(Field field)
 {
     if (field.Color == _color) return 2 * Amount;
     else return 0;
 }
Example #11
0
File: Bet.cs Project: dentych/I4SWT
 public virtual uint WonAmount(Field field)
 {
     return 0;
 }
Example #12
0
File: Bet.cs Project: dentych/I4SWT
 public override uint WonAmount(Field field)
 {
     if (field.Number == _fieldNumber) return 36 * Amount;
     else return 0;
 }
Example #13
0
File: Bet.cs Project: dentych/I4SWT
 public override uint WonAmount(Field field)
 {
     if (field.Even == _even) return 2 * Amount;
     else return 0;
 }
 public uint WonAmount(Field field)
 {
     throw new NotImplementedException();
 }
Example #15
0
 public void Spin()
 {
     var n = _randomize.RandomInt(0, 36);
     _result = _fields[n];
 }