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); //Act && Assert Assert.ThrowsException <ArgumentException>(() => sut.Run(n, m)); }
public void CreateNxMFullMatrix(int n, int m) { //Arrange var memoryCache = new MemoryCache(new MemoryCacheOptions()); var readerMock = new Mock <IFileReader>(); var sut = new SlotGamesServices(memoryCache, readerMock.Object); bool hasCorrectDimentions = true; bool doesntHave0Items = true; //0 Items will check two things: //First, if every cell is populated //Second, if there are any items, whose values are 0 (for whatever reason...) //Act var result = sut.Run(n, m); //Assert if (result.Count != n) { hasCorrectDimentions = false; } for (int i = 0; i < n; i++) { if (result[i].Count != m) { hasCorrectDimentions = false; break; } for (int j = 0; j < m; j++) { if ((int)result[i][j] == 0) { doesntHave0Items = false; } } } Assert.IsTrue(hasCorrectDimentions); Assert.IsTrue(doesntHave0Items); }