Example #1
0
 private void Initialization(int height, int width, int coinCount)
 {
     _mazeMock           = new Mock <IMaze>();
     _coinBuilderForTest = new CoinBuilderForTest(coinCount, _mockCoinFactory.Object);
     _mazeMock.Setup(a => a.Height).Returns(() => height);
     _mazeMock.Setup(a => a.Width).Returns(() => width);
     _mazeMock.Setup(a => a[It.IsAny <int>(), It.IsAny <int>()].IsEmpty).Returns(true);
 }
Example #2
0
        public void GetRandomPointSimpleTest(int height, int width)
        {
            var testEntity = new CoinBuilderForTest(10, _mockCoinFactory.Object);

            for (int i = 0; i < 100; i++)
            {
                var res = testEntity.GetRandomPointWrap(height, width);
                Assert.IsTrue(res.Item1 >= 0 && res.Item1 < height);
                Assert.IsTrue(res.Item2 >= 0 && res.Item2 < width);
            }
        }
Example #3
0
        public void GetRandomPoint_HeightOrWidthLessOrEqleNull_ThrowArgumentException(int height, int width)
        {
            var testEntity = new CoinBuilderForTest(10, _mockCoinFactory.Object);

            Assert.Throws <ArgumentException>(() => testEntity.GetRandomPointWrap(height, width));
        }