public void ShouldNotGetCellsAndLogError() { MockedDatabase <Cell> database; CellModule module; MemoryLogger logger; logger = new MemoryLogger(); database = new MockedDatabase <Cell>(true, 3, (t) => new Cell() { CellID = t }); module = new CellModule(logger, database); Assert.ThrowsException <PIODataException>(() => module.GetCells(1, 0, 0, 3, 3)); Assert.IsNotNull(logger.Logs.FirstOrDefault(item => (item.Level == LogLevels.Error) && (item.ComponentName == module.ModuleName))); }
public void ShouldGetCells() { MockedDatabase <Cell> database; CellModule module; Cell[] results; database = new MockedDatabase <Cell>(false, 3, (t) => new Cell() { CellID = t, X = t, Y = t }); module = new CellModule(NullLogger.Instance, database); results = module.GetCells(0, 0, 0, 1, 1); Assert.IsNotNull(results); Assert.AreEqual(3, results.Length); for (int t = 0; t < 3; t++) { Assert.IsNotNull(results[t]); Assert.AreEqual(t, results[t].CellID); } }