示例#1
0
        public void CorrectlyCalculateCoefficients(List <List <GameItemChanceOutOf100> > slotMatrix, decimal actualCoeff)
        {
            //Arrange
            var memoryCache = new MemoryCache(new MemoryCacheOptions());

            var readerMock = new Mock <IFileReader>();

            readerMock
            .Setup(rm => rm.ReadAllFrom(It.IsAny <string>()))
            .Returns(File.ReadAllText(@"..\..\..\..\BedeSlots.Services\GameCoefficients.json"));

            var sut = new SlotGamesServices(memoryCache, readerMock.Object);
            //Act
            var coeff = sut.Evaluate(slotMatrix);

            //Assert
            Assert.IsTrue(coeff == actualCoeff);
        }
示例#2
0
        public void ThrowArgumentExpcetion_WhenTheMatrixIsSamllerThan3x3(int n, int m)
        {
            //Arrange
            var memoryCache = new MemoryCache(new MemoryCacheOptions());
            var readerMock  = new Mock <IFileReader>();
            var sut         = new SlotGamesServices(memoryCache, readerMock.Object);
            var matrix      = new List <List <GameItemChanceOutOf100> >();

            for (int i = 0; i < n; i++)
            {
                var row = new List <GameItemChanceOutOf100>();
                for (int j = 0; j < m; j++)
                {
                    row.Add(GameItemChanceOutOf100.Apple);
                }
                matrix.Add(row);
            }
            //Act && Assert
            Assert.ThrowsException <ArgumentException>(() => sut.Evaluate(matrix));
        }